1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
|
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.de IX
..
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" fudge factors for nroff and troff
.
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
.\" simple accents for nroff and troff
.
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.\" troff and (daisy-wheel) nroff accents
.
.ds : \k:\h'-(\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \k:\h'-(\n(.wu+\w'\(de'u\-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\fI\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.\" corrections for vroff
.
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.\" for low resolution devices (crt and lpr)
.
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "GDBSERVER 1"
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.\"
.\" translated for 11.2 ribbon <ribbon@users.osdn.me>
.\"
.TH GDBSERVER 1 2022\-01\-16 gdb\-11.2 "GNU Development Tools"
.if n .ad l
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.nh
.SH 名前
gdbserver \- GNU デバッガー用リモートサーバー
.SH 書式
.IX Header 書式
gdbserver \fIcomm\fP \fIprog\fP [\fIargs\fP...]
.PP
gdbserver \-\-attach \fIcomm\fP \fIpid\fP
.PP
gdbserver \-\-multi \fIcomm\fP
.SH 説明
.IX Header 説明
\&\fBgdbserver\fP は、デバッグ対象のプログラムを実行しているマシンとは異なるマシン上で \s-1GDB\s0
を実行することを可能にするプログラムです。
.PP
使用方法 (サーバー(ターゲット)側):
.PP
まず、デバッグ対象のプログラムのコピーをターゲットシステムに用意します。 \&\fBgdbserver\fP は、 シンボルを関知しないので、
使用スペースを節約するためにプログラムからシンボルを取り除く (strip する) のでも構いません。
すべてのシンボルの処理は、ホストシステム上において動作する \s-1GDB\s0 が行います。
.PP
サーバーを使用するためには、ターゲットシステムにログインし、\fBgdbserver\fP プログラムを実行します。 その際には (a) \s-1GDB\s0
との通信方法、 (b) プログラム名、 (c) プログラムへの引数 を指定する必要があります。 一般的な書式は以下のようになります。
.PP
.Vb 1
\& target> gdbserver <comm> <program> [<args>
\&...]
.Ve
.PP
たとえば、シリアルポートを使用する場合は、以下のようになります。
.PP
.Vb 1
\& target> gdbserver /dev/com1 emacs foo.txt
.Ve
.PP
この例では、\fBgdbserver\fP に対して、emacs に引数 foo.txt を与えてデバッグすることを指定しています。 そして
\s-1GDB\s0 との通信に \fI/dev/com1\fP を使用します。 \fBgdbserver\fP は、ホストの \s-1GDB\s0
が通信して来ることを辛抱強く待ちます。
.PP
\s-1TCP\s0 接続を使用する場合は、以下のようになります。
.PP
.Vb 1
\& target> gdbserver host:2345 emacs foo.txt
.Ve
.PP
この例では、ホストの GDB との通信に TCP を用いる以外は、前の例と同じです。 引数 \f(CW\*(C`host:2345\*(C'\fP
は、\f(CW\*(C`host\*(C'\fP からの \s-1TCP\s0 接続が ローカルの \s-1TCP\s0 ポート 2345
に接続されるのを待つ、という意味です。 (現状では \f(CW\*(C`host\*(C'\fP 部は無視されます。) ターゲットシステムで存在する
\s-1TCP\s0 ポートとの衝突が無ければ、ポート番号は自由に選ぶことができます。 ホストの GDB の \f(CW\*(C`target
remote\*(C'\fP コマンドで、 同じポート番号を指定する必要があります。 他のサービスと衝突するポート番号を 選んだ場合、
\fBgdbserver\fP はエラーメッセージを出力して終了します。
.PP
\&\fBgdbserver\fP は、 実行中のプログラムに接続することができます。 これを行うには \fB\-\-attach\fP 引数を使用します。
書式は次の通りです。
.PP
.Vb 1
\& target> gdbserver \-\-attach <comm> <pid>
.Ve
.PP
\&\fIpid\fP は現在実行中のプロセスのプロセス \s-1ID\s0 です。 \fBgdbserver\fP
に実行中のプロセスのバイナリを指定する必要はありません。
.PP
初期起動するコマンド、 あるいはアタッチするプロセス \s-1ID\s0 を指定せずに \f(CW\*(C`gdbserver\*(C'\fP を起動するには、
コマンドラインオプション \fB\-\-multi\fP を用います。 この場合は、 \f(CW\*(C`target extended\-remote\*(C'\fP
を利用して、デバッグしたいプログラムを起動して連携することが必要です。
.PP
.Vb 1
\& target> gdbserver \-\-multi <comm>
.Ve
.PP
使用方法 (ホスト側):
.PP
\&\s-1GDB\s0 がシンボルテーブルを検査したりするため、 ホストシステムには、 ターゲットプログラムのシンボルが取り除かれていない
(strip されていない) コピーが必要です。 通常の場合同様、 最初の引数にターゲットプログラムを指定して GDB を起動します。
(シリアル回線のボーレート (baud rate) が 9600 以外の場合は、\&\fB\-\-baud\fP オプションの指定が必要になります。)
つまり、\f(CW\*(C`gdb TARGET\-PROG\*(C'\fP あるいは \f(CW\*(C`gdb \-\-baud BAUD
TARGET\-PROG\*(C'\fP のように起動します。 その後、新たに覚える必要のあるコマンドは、\f(CW\*(C`target
remote\*(C'\fP (あるいは \f(CW\*(C`target extended\-remote\*(C'\fP) だけです。
コマンドの引数は、デバイス名 (通常 \fI/dev/ttyb\fP のようなシリアルデバイス) か、 \f(CW\*(C`HOST:PORT\*(C'\fP
記述子です。 たとえば、
.PP
.Vb 1
\& (gdb) target remote /dev/ttyb
.Ve
.PP
は、シリアル回線 \fI/dev/ttyb\fP を使用してサーバーと通信します。また、
.PP
.Vb 1
\& (gdb) target remote the\-target:2345
.Ve
.PP
は、\s-1TCP\s0 接続で、ホスト `the\-target' の \fBgdbserver\fP を起動した時に指定したポートと同じポート 2345
を使用してサーバーと通信します。 \&\s-1TCP\s0 接続の場合、 `target remote' コマンドを実行する前に
\fBgdbserver\fP を実行しておく必要があります。 そうしないと、`Connection refused' というようなエラーになるでしょう。
.PP
\&\fBgdbserver\fP では、 一度に複数の inferior オブジェクトをデバッグできます。 これについては \s-1GDB\s0
マニュアルの \f(CW\*(C`Inferiors Connections and Programs\*(C'\fP ノードにおいて説明しています。
\&\*(-- シェルコマンドでは \f(CW\*(C`info \-f gdb \-n \*(AqInferiors Connections and
Programs\*(Aq\*(C'\fP とします。 この場合は、 \s-1GDB\s0 コマンドの別の形である
\f(CW\*(C`extended\-remote\*(C'\fP \s-1GDB\s0 を実行します。
.PP
.Vb 1
\& (gdb) target extended\-remote the\-target:2345
.Ve
.PP
\fBgdbserver\fP オプションである \fB\-\-multi\fP は、 この場合に使っても使わなくてもかまいません。
.SH オプション
.IX Header オプション
\fBgdbserver\fP の起動方法には 3 つのモードがあります。
.IP \(bu 4
プログラム名指定によるプログラムデバッグ:
.Sp
.Vb 1
\& gdbserver <comm> <prog> [<args>...]
.Ve
.Sp
パラメーター \fIcomm\fP は、サーバーが \s-1GDB\s0 と通信するための方法を指定します。 その値は、デバイス名 (シリアル回線利用時)、
\s-1TCP\s0 ポート番号 (\f(CW\*(C`:1234\*(C'\fP)、 \f(CW\*(C`\-\*(C'\fP または
\f(CW\*(C`stdio\*(C'\fP (\f(CW\*(C`gdbserver\*(C'\fP の標準入出力利用時) のいずれかです。
デバッグするプログラム名は \fIprog\fP に指定します。 残りの引数は、 そのままプログラムに受け渡されます。 プログラムが終了すると、
\s-1GDB\s0 が接続を閉じ、\f(CW\*(C`gdbserver\*(C'\fP は終了します。
.IP \(bu 4
プログラム実行中のプロセス \s-1ID\s0 を指定したプログラムデバッグ:
.Sp
.Vb 1
\& gdbserver \-\-attach <comm> <pid>
.Ve
.Sp
パラメーター \fIcomm\fP については前述済です。 実行しているプログラムのプロセス \s-1ID\s0 を \fIpid\fP に指定します。 後は
\s-1GDB\s0 がすべてを処理します。 前項目のモードと同じように、プロセス \fIpid\fP が終了すると、 \&\s-1GDB\s0
が接続を閉じ、 \f(CW\*(C`gdbserver\*(C'\fP は終了します。
.IP \(bu 4
マルチプロセスモード \*(-- 複数のプログラム/プロセスのデバッグ:
.Sp
.Vb 1
\& gdbserver \-\-multi <comm>
.Ve
.Sp
このモードにおいては、 \s-1GDB\s0 が \fBgdbserver\fP に対して実行コマンドを指示します。 上のそれまでの 2
つのモードとは違って、 デバッグされていたプロセスが終了しても、 \s-1GDB\s0 は接続を閉じません。 したがって同一セッション内において、
複数のプロセスをデバッグすることができます。
.PP
いずれのモードにおいても、 以下のオプションが指定できます。
.IP \fB\-\-help\fP 4
.IX Item \-\-help
短い説明つきで、 すべてのオプションを表示します。
.IP \fB\-\-version\fP 4
.IX Item \-\-version
このオプションにより \fBgdbserver\fP はバージョン番号を表示して終了します。
.IP \fB\-\-attach\fP 4
.IX Item \-\-attach
\&\fBgdbserver\fP は実行中プログラムにアタッチします。 その文法は以下のとおりです。
.Sp
.Vb 1
\& target> gdbserver \-\-attach <comm> <pid>
.Ve
.Sp
\&\fIpid\fP は現在実行中のプロセスのプロセス \s-1ID\s0 です。 \fBgdbserver\fP
に実行中のプロセスのバイナリを指定する必要はありません。
.IP \fB\-\-multi\fP 4
.IX Item \-\-multi
初期起動するコマンド、 あるいはアタッチするプロセス \s-1ID\s0 を指定せずに \f(CW\*(C`gdbserver\*(C'\fP を起動するには、
このコマンドラインオプションを用います。 そして \f(CW\*(C`target extended\-remote\*(C'\fP を利用して、
デバッグしたいプログラムを起動します。 その文法は以下のとおりです。
.Sp
.Vb 1
\& target> gdbserver \-\-multi <comm>
.Ve
.IP \fB\-\-debug\fP 4
.IX Item \-\-debug
\f(CW\*(C`gdbserver\*(C'\fP に対して、 デバッグ処理における追加ステータス情報を表示するように指示します。 このオプションは
\f(CW\*(C`gdbserver\*(C'\fP 開発向けとして、 開発およびバグ報告に用いることを意図しています。
.IP \fB\-\-remote\-debug\fP 4
.IX Item \-\-remote\-debug
\f(CW\*(C`gdbserver\*(C'\fP に対して、 リモートプロトコルによるデバッグ出力を行うことを指示します。 このオプションは
\f(CW\*(C`gdbserver\*(C'\fP 開発向けとして、 開発およびバグ報告に用いることを意図しています。
.IP \fB\-\-debug\-file=\fP\fIfilename\fP 4
.IX Item \-\-debug\-file=filename
\f(CW\*(C`gdbserver\*(C'\fP に対して、デバッグ出力を指定した \fIfilename\fP に書き出すことを指示します。 このオプションは
\f(CW\*(C`gdbserver\*(C'\fP 開発向けとして、 開発およびバグ報告に用いることを意図しています。
.IP \fB\-\-debug\-format=option1\fP[\fB,option2,...\fP] 4
.IX Item \-\-debug\-format=option1[,option2,...]
\f(CW\*(C`gdbserver\*(C'\fP に対して、 デバッグ出力の各行に追加情報を含めることを指示します。
.IP \fB\-\-wrapper\fP 4
.IX Item \-\-wrapper
デバッグを行うために起動するプログラムのラッパーを指定します。 このオプションに続けて、 ラッパー名を指定することが必要です。
ラッパーに受け渡すコマンドライン引数があれば、続けて記述します。 \&\f(CW\*(C`\-\-\*(C'\fP を記述して、
ラッパーへの引数の終わりを指示します。
.IP \fB\-\-once\fP 4
.IX Item \-\-once
デフォルトで \fBgdbserver\fP は \s-1TCP\s0 ポートを開いたまま、 待ち続けます。 したがって追加で接続することが可能です。 ただし
\f(CW\*(C`gdbserver\*(C'\fP に \fB\-\-once\fP オプションをつけて実行すると、 最初の \s-1GDB\s0
セッションの接続を終えたら、 ポートの待ち受けを停止して、 それ以上の接続は行いません。
.SH 関連項目
.IX Header 関連項目
\s-1GDB\s0 の完全なドキュメントは Texinfo マニュアルとしてメンテナンスされています。\f(CW\*(C`info\*(C'\fP と
\f(CW\*(C`gdb\*(C'\fP の両プログラム、および \s-1GDB\s0 の Texinfo
ドキュメントが適切にインストールされていれば、以下のコマンド
.PP
.Vb 1
\& info gdb
.Ve
.PP
を実行して完全なマニュアルを参照できます。
.PP
\&\fIUsing \s-1GDB: A\s0 Guide to the \s-1GNU\s0 Source\-Level Debugger\fP,
Richard M. Stallman and Roland H. Pesch, July 1991.
.SH 著作権
.IX Header 著作権
Copyright (c) 1988\-2022 Free Software Foundation, Inc.
.PP
Permission is granted to copy, distribute and/or modify this document under
the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or any
later version published by the Free Software Foundation; with the Invariant
Sections being \*(L"Free Software\*(R" and \*(L"Free Software Needs Free
Documentation\*(R", with the Front\-Cover Texts being \*(L"A \s-1GNU\s0
Manual,\*(R" and with the Back\-Cover Texts as in (a) below.
.PP
(a) \s-1FSF\s0 の裏表紙には、 以下の文章が記述されています: \*(L"You are free to copy and modify
this \s-1GNU\s0 Manual. Buying copies from \s-1GNU\s0 Press supports the
\s-1FSF\s0 in developing \s-1GNU\s0 and promoting software freedom.\*(R"
|