Révision | 19d9d4efd18bcc633e99cb6a3e39bd9b22ca70ce (tree) |
---|---|
l'heure | 2015-12-15 04:18:06 |
Auteur | Don Breazeal <donb@code...> |
Commiter | Don Breazeal |
Target remote mode fork and exec event documentation
This patch implements documentation updates for target remote mode fork and
exec events. A summary of the rationale for the changes made here:
* Connecting to a remote target -- explain that the two protocols exist.
* Connecting in target remote mode -- explain invoking gdbserver for target
* Connecting in target extended-remote mode -- promote this section from
* Host and target files -- collect paragraphs dealing with how to locate
* Steps for connecting to a remote target -- used to be "Using the
* Remote connection commands -- used to be the bulk of "Connecting to a
gdb/ChangeLog:
* NEWS: Announce fork and exec event support for target remote.
gdb/doc/ChangeLog:
* gdb.texinfo (Forks): Correct Linux kernel version where
fork and exec events are supported, add notes about support
of these events in target remote mode.
(Connecting): Reorganize and clarify distinctions between
target remote, extended-remote, and multiprocess.
Reorganize related text from separate sections into new
sections.
(Server): Note effects of target extended-remote mode.
Delete section on Multi-Process Mode for gdbserver.
Move some text to "Connecting" node.
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2015-12-11 Don Breazeal <donb@codesourcery.com> |
2 | 2 | |
3 | + * NEWS: Announce fork and exec event support for target remote. | |
4 | + | |
5 | +2015-12-11 Don Breazeal <donb@codesourcery.com> | |
6 | + | |
3 | 7 | * inferior.c (number_of_live_inferiors): New function. |
4 | 8 | (have_live_inferiors): Use number_of_live_inferiors in place |
5 | 9 | of duplicate code. |
@@ -135,6 +135,13 @@ show remote exec-event-feature-packet | ||
135 | 135 | The reply to qXfer:threads:read may now include a name attribute for each |
136 | 136 | thread. |
137 | 137 | |
138 | +* Target remote mode fork and exec events | |
139 | + | |
140 | + ** GDB now has support for fork and exec events on target remote mode | |
141 | + Linux targets. For such targets with Linux kernels 2.5.46 and later, | |
142 | + this enables follow-fork-mode, detach-on-fork, follow-exec-mode, and | |
143 | + fork and exec catchpoints. | |
144 | + | |
138 | 145 | * MI changes |
139 | 146 | |
140 | 147 | ** The -var-set-format command now accepts the zero-hexadecimal |
@@ -1,3 +1,16 @@ | ||
1 | +2015-12-11 Don Breazeal <donb@codesourcery.com> | |
2 | + | |
3 | + * gdb.texinfo (Forks): Correct Linux kernel version where | |
4 | + fork and exec events are supported, add notes about support | |
5 | + of these events in target remote mode. | |
6 | + (Connecting): Reorganize and clarify distinctions between | |
7 | + target remote, extended-remote, and multiprocess. | |
8 | + Reorganize related text from separate sections into new | |
9 | + sections. | |
10 | + (Server): Note effects of target extended-remote mode. | |
11 | + Delete section on Multi-Process Mode for gdbserver. | |
12 | + Move some text to "Connecting" node. | |
13 | + | |
1 | 14 | 2015-12-10 Pedro Alves <palves@redhat.com> |
2 | 15 | |
3 | 16 | * gdb.texinfo (Threads): Replace warning with explanation |
@@ -3119,10 +3119,11 @@ the child process just like any other process which you attached to. | ||
3119 | 3119 | On some systems, @value{GDBN} provides support for debugging programs |
3120 | 3120 | that create additional processes using the @code{fork} or @code{vfork} |
3121 | 3121 | functions. On @sc{gnu}/Linux platforms, this feature is supported |
3122 | -with kernel version 2.5.60 and later. | |
3122 | +with kernel version 2.5.46 and later. | |
3123 | 3123 | |
3124 | -The fork debugging commands are supported in both native mode and when | |
3125 | -connected to @code{gdbserver} using @kbd{target extended-remote}. | |
3124 | +The fork debugging commands are supported in native mode and when | |
3125 | +connected to @code{gdbserver} in either @code{target remote} mode or | |
3126 | +@code{target extended-remote} mode. | |
3126 | 3127 | |
3127 | 3128 | By default, when a program forks, @value{GDBN} will continue to debug |
3128 | 3129 | the parent process and the child process will run unimpeded. |
@@ -3268,6 +3269,9 @@ Program exited normally. | ||
3268 | 3269 | @end table |
3269 | 3270 | @end table |
3270 | 3271 | |
3272 | +@code{follow-exec-mode} is supported in native mode and | |
3273 | +@code{target extended-remote} mode. | |
3274 | + | |
3271 | 3275 | You can use the @code{catch} command to make @value{GDBN} stop whenever |
3272 | 3276 | a @code{fork}, @code{vfork}, or @code{exec} call is made. @xref{Set |
3273 | 3277 | Catchpoints, ,Setting Catchpoints}. |
@@ -19248,28 +19252,148 @@ configuration of @value{GDBN}; use @code{help target} to list them. | ||
19248 | 19252 | |
19249 | 19253 | @node Connecting |
19250 | 19254 | @section Connecting to a Remote Target |
19255 | +@cindex remote debugging, connecting | |
19256 | +@cindex @code{gdbserver}, connecting | |
19257 | +@cindex remote debugging, types of connections | |
19258 | +@cindex @code{gdbserver}, types of connections | |
19259 | +@cindex @code{gdbserver}, @code{target remote} mode | |
19260 | +@cindex @code{gdbserver}, @code{target extended-remote} mode | |
19261 | + | |
19262 | +This section describes how to connect to a remote target, including the | |
19263 | +types of connections and their differences, how to set up executable and | |
19264 | +symbol files on the host and target, and the commands used for | |
19265 | +connecting to and disconnecting from the remote target. | |
19266 | + | |
19267 | +@subsection Types of Remote Connections | |
19268 | + | |
19269 | +@value{GDBN} supports two types of remote connections, @code{target remote} | |
19270 | +mode and @code{target extended-remote} mode. Note that many remote targets | |
19271 | +support only @code{target remote} mode. There are several major | |
19272 | +differences between the two types of connections, enumerated here: | |
19251 | 19273 | |
19252 | -@value{GDBN} needs an unstripped copy of your program to access symbol | |
19253 | -and debugging information. Some remote targets (@pxref{qXfer | |
19254 | -executable filename read}, and @pxref{Host I/O Packets}) allow | |
19255 | -@value{GDBN} to access program files over the same connection used to | |
19256 | -communicate with @value{GDBN}. With such a target, if the remote | |
19257 | -program is unstripped, the only command you need is @code{target | |
19258 | -remote}. Otherwise, start up @value{GDBN} using the name of the local | |
19274 | +@table @asis | |
19275 | + | |
19276 | +@cindex remote debugging, detach and program exit | |
19277 | +@item Result of detach or program exit | |
19278 | +@strong{With target remote mode:} When the debugged program exits or you | |
19279 | +detach from it, @value{GDBN} disconnects from the target. When using | |
19280 | +@code{gdbserver}, @code{gdbserver} will exit. | |
19281 | + | |
19282 | +@strong{With target extended-remote mode:} When the debugged program exits or | |
19283 | +you detach from it, @value{GDBN} remains connected to the target, even | |
19284 | +though no program is running. You can rerun the program, attach to a | |
19285 | +running program, or use @code{monitor} commands specific to the target. | |
19286 | + | |
19287 | +When using @code{gdbserver} in this case, it does not exit unless it was | |
19288 | +invoked using the @option{--once} option. If the @option{--once} option | |
19289 | +was not used, you can ask @code{gdbserver} to exit using the | |
19290 | +@code{monitor exit} command (@pxref{Monitor Commands for gdbserver}). | |
19291 | + | |
19292 | +@item Specifying the program to debug | |
19293 | +For both connection types you use the @code{file} command to specify the | |
19294 | +program on the host system. If you are using @code{gdbserver} there are | |
19295 | +some differences in how to specify the location of the program on the | |
19296 | +target. | |
19297 | + | |
19298 | +@strong{With target remote mode:} You must either specify the program to debug | |
19299 | +on the @code{gdbserver} command line or use the @option{--attach} option | |
19300 | +(@pxref{Attaching to a program,,Attaching to a Running Program}). | |
19301 | + | |
19302 | +@cindex @option{--multi}, @code{gdbserver} option | |
19303 | +@strong{With target extended-remote mode:} You may specify the program to debug | |
19304 | +on the @code{gdbserver} command line, or you can load the program or attach | |
19305 | +to it using @value{GDBN} commands after connecting to @code{gdbserver}. | |
19306 | + | |
19307 | +@anchor{--multi Option in Types of Remote Connnections} | |
19308 | +You can start @code{gdbserver} without supplying an initial command to run | |
19309 | +or process ID to attach. To do this, use the @option{--multi} command line | |
19310 | +option. Then you can connect using @code{target extended-remote} and start | |
19311 | +the program you want to debug (see below for details on using the | |
19312 | +@code{run} command in this scenario). Note that the conditions under which | |
19313 | +@code{gdbserver} terminates depend on how @value{GDBN} connects to it | |
19314 | +(@code{target remote} or @code{target extended-remote}). The | |
19315 | +@option{--multi} option to @code{gdbserver} has no influence on that. | |
19316 | + | |
19317 | +@item The @code{run} command | |
19318 | +@strong{With target remote mode:} The @code{run} command is not | |
19319 | +supported. Once a connection has been established, you can use all | |
19320 | +the usual @value{GDBN} commands to examine and change data. The | |
19321 | +remote program is already running, so you can use commands like | |
19322 | +@kbd{step} and @kbd{continue}. | |
19323 | + | |
19324 | +@strong{With target extended-remote mode:} The @code{run} command is | |
19325 | +supported. The @code{run} command uses the value set by | |
19326 | +@code{set remote exec-file} (@pxref{set remote exec-file}) to select | |
19327 | +the program to run. Command line arguments are supported, except for | |
19328 | +wildcard expansion and I/O redirection (@pxref{Arguments}). | |
19329 | + | |
19330 | +If you specify the program to debug on the command line, then the | |
19331 | +@code{run} command is not required to start execution, and you can | |
19332 | +resume using commands like @kbd{step} and @kbd{continue} as with | |
19333 | +@code{target remote} mode. | |
19334 | + | |
19335 | +@anchor{Attaching in Types of Remote Connections} | |
19336 | +@item Attaching | |
19337 | +@strong{With target remote mode:} The @value{GDBN} command @code{attach} is | |
19338 | +not supported. To attach to a running program using @code{gdbserver}, you | |
19339 | +must use the @option{--attach} option (@pxref{Running gdbserver}). | |
19340 | + | |
19341 | +@strong{With target extended-remote mode:} To attach to a running program, | |
19342 | +you may use the @code{attach} command after the connection has been | |
19343 | +established. If you are using @code{gdbserver}, you may also invoke | |
19344 | +@code{gdbserver} using the @option{--attach} option | |
19345 | +(@pxref{Running gdbserver}). | |
19346 | + | |
19347 | +@end table | |
19348 | + | |
19349 | +@anchor{Host and target files} | |
19350 | +@subsection Host and Target Files | |
19351 | +@cindex remote debugging, symbol files | |
19352 | +@cindex symbol files, remote debugging | |
19353 | + | |
19354 | +@value{GDBN}, running on the host, needs access to symbol and debugging | |
19355 | +information for your program running on the target. This requires | |
19356 | +access to an unstripped copy of your program, and possibly any associated | |
19357 | +symbol files. Note that this section applies equally to both @code{target | |
19358 | +remote} mode and @code{target extended-remote} mode. | |
19359 | + | |
19360 | +Some remote targets (@pxref{qXfer executable filename read}, and | |
19361 | +@pxref{Host I/O Packets}) allow @value{GDBN} to access program files over | |
19362 | +the same connection used to communicate with @value{GDBN}. With such a | |
19363 | +target, if the remote program is unstripped, the only command you need is | |
19364 | +@code{target remote} (or @code{target extended-remote}). | |
19365 | + | |
19366 | +If the remote program is stripped, or the target does not support remote | |
19367 | +program file access, start up @value{GDBN} using the name of the local | |
19259 | 19368 | unstripped copy of your program as the first argument, or use the |
19260 | -@code{file} command. | |
19369 | +@code{file} command. Use @code{set sysroot} to specify the location (on | |
19370 | +the host) of target libraries (unless your @value{GDBN} was compiled with | |
19371 | +the correct sysroot using @code{--with-sysroot}). Alternatively, you | |
19372 | +may use @code{set solib-search-path} to specify how @value{GDBN} locates | |
19373 | +target libraries. | |
19374 | + | |
19375 | +The symbol file and target libraries must exactly match the executable | |
19376 | +and libraries on the target, with one exception: the files on the host | |
19377 | +system should not be stripped, even if the files on the target system | |
19378 | +are. Mismatched or missing files will lead to confusing results | |
19379 | +during debugging. On @sc{gnu}/Linux targets, mismatched or missing | |
19380 | +files may also prevent @code{gdbserver} from debugging multi-threaded | |
19381 | +programs. | |
19261 | 19382 | |
19262 | -@cindex @code{target remote} | |
19383 | +@subsection Remote Connection Commands | |
19384 | +@cindex remote connection commands | |
19263 | 19385 | @value{GDBN} can communicate with the target over a serial line, or |
19264 | 19386 | over an @acronym{IP} network using @acronym{TCP} or @acronym{UDP}. In |
19265 | 19387 | each case, @value{GDBN} uses the same protocol for debugging your |
19266 | 19388 | program; only the medium carrying the debugging packets varies. The |
19267 | -@code{target remote} command establishes a connection to the target. | |
19268 | -Its arguments indicate which medium to use: | |
19389 | +@code{target remote} and @code{target extended-remote} commands | |
19390 | +establish a connection to the target. Both commands accept the same | |
19391 | +arguments, which indicate the medium to use: | |
19269 | 19392 | |
19270 | 19393 | @table @code |
19271 | 19394 | |
19272 | 19395 | @item target remote @var{serial-device} |
19396 | +@itemx target extended-remote @var{serial-device} | |
19273 | 19397 | @cindex serial line, @code{target remote} |
19274 | 19398 | Use @var{serial-device} to communicate with the target. For example, |
19275 | 19399 | to use a serial line connected to the device named @file{/dev/ttyb}: |
@@ -19285,6 +19409,8 @@ If you're using a serial line, you may want to give @value{GDBN} the | ||
19285 | 19409 | |
19286 | 19410 | @item target remote @code{@var{host}:@var{port}} |
19287 | 19411 | @itemx target remote @code{tcp:@var{host}:@var{port}} |
19412 | +@itemx target extended-remote @code{@var{host}:@var{port}} | |
19413 | +@itemx target extended-remote @code{tcp:@var{host}:@var{port}} | |
19288 | 19414 | @cindex @acronym{TCP} port, @code{target remote} |
19289 | 19415 | Debug using a @acronym{TCP} connection to @var{port} on @var{host}. |
19290 | 19416 | The @var{host} may be either a host name or a numeric @acronym{IP} |
@@ -19313,6 +19439,7 @@ target remote :1234 | ||
19313 | 19439 | Note that the colon is still required here. |
19314 | 19440 | |
19315 | 19441 | @item target remote @code{udp:@var{host}:@var{port}} |
19442 | +@itemx target extended-remote @code{udp:@var{host}:@var{port}} | |
19316 | 19443 | @cindex @acronym{UDP} port, @code{target remote} |
19317 | 19444 | Debug using @acronym{UDP} packets to @var{port} on @var{host}. For example, to |
19318 | 19445 | connect to @acronym{UDP} port 2828 on a terminal server named @code{manyfarms}: |
@@ -19327,6 +19454,7 @@ can silently drop packets on busy or unreliable networks, which will | ||
19327 | 19454 | cause havoc with your debugging session. |
19328 | 19455 | |
19329 | 19456 | @item target remote | @var{command} |
19457 | +@itemx target extended-remote | @var{command} | |
19330 | 19458 | @cindex pipe, @code{target remote} to |
19331 | 19459 | Run @var{command} in the background and communicate with it using a |
19332 | 19460 | pipe. The @var{command} is a shell command, to be parsed and expanded |
@@ -19342,11 +19470,6 @@ program has already exited, this will have no effect.) | ||
19342 | 19470 | |
19343 | 19471 | @end table |
19344 | 19472 | |
19345 | -Once the connection has been established, you can use all the usual | |
19346 | -commands to examine and change data. The remote program is already | |
19347 | -running; you can use @kbd{step} and @kbd{continue}, and you do not | |
19348 | -need to use @kbd{run}. | |
19349 | - | |
19350 | 19473 | @cindex interrupting remote programs |
19351 | 19474 | @cindex remote programs, interrupting |
19352 | 19475 | Whenever @value{GDBN} is waiting for the remote program, if you type the |
@@ -19360,10 +19483,13 @@ Interrupted while waiting for the program. | ||
19360 | 19483 | Give up (and stop debugging it)? (y or n) |
19361 | 19484 | @end smallexample |
19362 | 19485 | |
19363 | -If you type @kbd{y}, @value{GDBN} abandons the remote debugging session. | |
19364 | -(If you decide you want to try again later, you can use @samp{target | |
19365 | -remote} again to connect once more.) If you type @kbd{n}, @value{GDBN} | |
19366 | -goes back to waiting. | |
19486 | +In @code{target remote} mode, if you type @kbd{y}, @value{GDBN} abandons | |
19487 | +the remote debugging session. (If you decide you want to try again later, | |
19488 | +you can use @kbd{target remote} again to connect once more.) If you type | |
19489 | +@kbd{n}, @value{GDBN} goes back to waiting. | |
19490 | + | |
19491 | +In @code{target extended-remote} mode, typing @kbd{n} will leave | |
19492 | +@value{GDBN} connected to the target. | |
19367 | 19493 | |
19368 | 19494 | @table @code |
19369 | 19495 | @kindex detach (remote) |
@@ -19372,11 +19498,13 @@ When you have finished debugging the remote program, you can use the | ||
19372 | 19498 | @code{detach} command to release it from @value{GDBN} control. |
19373 | 19499 | Detaching from the target normally resumes its execution, but the results |
19374 | 19500 | will depend on your particular remote stub. After the @code{detach} |
19375 | -command, @value{GDBN} is free to connect to another target. | |
19501 | +command in @code{target remote} mode, @value{GDBN} is free to connect to | |
19502 | +another target. In @code{target extended-remote} mode, @value{GDBN} is | |
19503 | +still connected to the target. | |
19376 | 19504 | |
19377 | 19505 | @kindex disconnect |
19378 | 19506 | @item disconnect |
19379 | -The @code{disconnect} command behaves like @code{detach}, except that | |
19507 | +The @code{disconnect} command closes the connection to the target, and | |
19380 | 19508 | the target is generally not resumed. It will wait for @value{GDBN} |
19381 | 19509 | (this instance or another one) to connect and continue debugging. After |
19382 | 19510 | the @code{disconnect} command, @value{GDBN} is again free to connect to |
@@ -19433,7 +19561,8 @@ Delete @var{targetfile} from the target system. | ||
19433 | 19561 | @cindex remote connection without stubs |
19434 | 19562 | @code{gdbserver} is a control program for Unix-like systems, which |
19435 | 19563 | allows you to connect your program with a remote @value{GDBN} via |
19436 | -@code{target remote}---but without linking in the usual debugging stub. | |
19564 | +@code{target remote} or @code{target extended-remote}---but without | |
19565 | +linking in the usual debugging stub. | |
19437 | 19566 | |
19438 | 19567 | @code{gdbserver} is not a complete replacement for the debugging stubs, |
19439 | 19568 | because it requires essentially the same operating-system facilities |
@@ -19461,6 +19590,7 @@ target system with the same privileges as the user running | ||
19461 | 19590 | @code{gdbserver}. |
19462 | 19591 | @end quotation |
19463 | 19592 | |
19593 | +@anchor{Running gdbserver} | |
19464 | 19594 | @subsection Running @code{gdbserver} |
19465 | 19595 | @cindex arguments, to @code{gdbserver} |
19466 | 19596 | @cindex @code{gdbserver}, command-line arguments |
@@ -19528,6 +19658,7 @@ Programs started with stdio-connected gdbserver have @file{/dev/null} for | ||
19528 | 19658 | display through a pipe connected to gdbserver. |
19529 | 19659 | Both @code{stdout} and @code{stderr} use the same pipe. |
19530 | 19660 | |
19661 | +@anchor{Attaching to a program} | |
19531 | 19662 | @subsubsection Attaching to a Running Program |
19532 | 19663 | @cindex attach to a program, @code{gdbserver} |
19533 | 19664 | @cindex @option{--attach}, @code{gdbserver} option |
@@ -19539,8 +19670,12 @@ This is accomplished via the @code{--attach} argument. The syntax is: | ||
19539 | 19670 | target> gdbserver --attach @var{comm} @var{pid} |
19540 | 19671 | @end smallexample |
19541 | 19672 | |
19542 | -@var{pid} is the process ID of a currently running process. It isn't necessary | |
19543 | -to point @code{gdbserver} at a binary for the running process. | |
19673 | +@var{pid} is the process ID of a currently running process. It isn't | |
19674 | +necessary to point @code{gdbserver} at a binary for the running process. | |
19675 | + | |
19676 | +In @code{target extended-remote} mode, you can also attach using the | |
19677 | +@value{GDBN} attach command | |
19678 | +(@pxref{Attaching in Types of Remote Connections}). | |
19544 | 19679 | |
19545 | 19680 | @pindex pidof |
19546 | 19681 | You can debug processes by name instead of process ID if your target has the |
@@ -19554,41 +19689,10 @@ In case more than one copy of @var{program} is running, or @var{program} | ||
19554 | 19689 | has multiple threads, most versions of @code{pidof} support the |
19555 | 19690 | @code{-s} option to only return the first process ID. |
19556 | 19691 | |
19557 | -@subsubsection Multi-Process Mode for @code{gdbserver} | |
19558 | -@cindex @code{gdbserver}, multiple processes | |
19559 | -@cindex multiple processes with @code{gdbserver} | |
19560 | - | |
19561 | -When you connect to @code{gdbserver} using @code{target remote}, | |
19562 | -@code{gdbserver} debugs the specified program only once. When the | |
19563 | -program exits, or you detach from it, @value{GDBN} closes the connection | |
19564 | -and @code{gdbserver} exits. | |
19565 | - | |
19566 | -If you connect using @kbd{target extended-remote}, @code{gdbserver} | |
19567 | -enters multi-process mode. When the debugged program exits, or you | |
19568 | -detach from it, @value{GDBN} stays connected to @code{gdbserver} even | |
19569 | -though no program is running. The @code{run} and @code{attach} | |
19570 | -commands instruct @code{gdbserver} to run or attach to a new program. | |
19571 | -The @code{run} command uses @code{set remote exec-file} (@pxref{set | |
19572 | -remote exec-file}) to select the program to run. Command line | |
19573 | -arguments are supported, except for wildcard expansion and I/O | |
19574 | -redirection (@pxref{Arguments}). | |
19575 | - | |
19576 | -@cindex @option{--multi}, @code{gdbserver} option | |
19577 | -To start @code{gdbserver} without supplying an initial command to run | |
19578 | -or process ID to attach, use the @option{--multi} command line option. | |
19579 | -Then you can connect using @kbd{target extended-remote} and start | |
19580 | -the program you want to debug. | |
19581 | - | |
19582 | -In multi-process mode @code{gdbserver} does not automatically exit unless you | |
19583 | -use the option @option{--once}. You can terminate it by using | |
19584 | -@code{monitor exit} (@pxref{Monitor Commands for gdbserver}). Note that the | |
19585 | -conditions under which @code{gdbserver} terminates depend on how @value{GDBN} | |
19586 | -connects to it (@kbd{target remote} or @kbd{target extended-remote}). The | |
19587 | -@option{--multi} option to @code{gdbserver} has no influence on that. | |
19588 | - | |
19589 | 19692 | @subsubsection TCP port allocation lifecycle of @code{gdbserver} |
19590 | 19693 | |
19591 | -This section applies only when @code{gdbserver} is run to listen on a TCP port. | |
19694 | +This section applies only when @code{gdbserver} is run to listen on a TCP | |
19695 | +port. | |
19592 | 19696 | |
19593 | 19697 | @code{gdbserver} normally terminates after all of its debugged processes have |
19594 | 19698 | terminated in @kbd{target remote} mode. On the other hand, for @kbd{target |
@@ -19619,6 +19723,12 @@ instance closes its port after the first connection. | ||
19619 | 19723 | @anchor{Other Command-Line Arguments for gdbserver} |
19620 | 19724 | @subsubsection Other Command-Line Arguments for @code{gdbserver} |
19621 | 19725 | |
19726 | +You can use the @option{--multi} option to start @code{gdbserver} without | |
19727 | +specifying a program to debug or a process to attach to. Then you can | |
19728 | +attach in @code{target extended-remote} mode and run or attach to a | |
19729 | +program. For more information, | |
19730 | +@pxref{--multi Option in Types of Remote Connnections}. | |
19731 | + | |
19622 | 19732 | @cindex @option{--debug}, @code{gdbserver} option |
19623 | 19733 | The @option{--debug} option tells @code{gdbserver} to display extra |
19624 | 19734 | status information about the debugging process. |
@@ -19670,32 +19780,34 @@ $ gdbserver --wrapper env LD_PRELOAD=libtest.so -- :2222 ./testprog | ||
19670 | 19780 | |
19671 | 19781 | @subsection Connecting to @code{gdbserver} |
19672 | 19782 | |
19673 | -Run @value{GDBN} on the host system. | |
19783 | +The basic procedure for connecting to the remote target is: | |
19784 | +@itemize | |
19674 | 19785 | |
19675 | -First make sure you have the necessary symbol files. Load symbols for | |
19676 | -your application using the @code{file} command before you connect. Use | |
19677 | -@code{set sysroot} to locate target libraries (unless your @value{GDBN} | |
19678 | -was compiled with the correct sysroot using @code{--with-sysroot}). | |
19786 | +@item | |
19787 | +Run @value{GDBN} on the host system. | |
19679 | 19788 | |
19680 | -The symbol file and target libraries must exactly match the executable | |
19681 | -and libraries on the target, with one exception: the files on the host | |
19682 | -system should not be stripped, even if the files on the target system | |
19683 | -are. Mismatched or missing files will lead to confusing results | |
19684 | -during debugging. On @sc{gnu}/Linux targets, mismatched or missing | |
19685 | -files may also prevent @code{gdbserver} from debugging multi-threaded | |
19686 | -programs. | |
19789 | +@item | |
19790 | +Make sure you have the necessary symbol files | |
19791 | +(@pxref{Host and target files}). | |
19792 | +Load symbols for your application using the @code{file} command before you | |
19793 | +connect. Use @code{set sysroot} to locate target libraries (unless your | |
19794 | +@value{GDBN} was compiled with the correct sysroot using | |
19795 | +@code{--with-sysroot}). | |
19687 | 19796 | |
19797 | +@item | |
19688 | 19798 | Connect to your target (@pxref{Connecting,,Connecting to a Remote Target}). |
19689 | 19799 | For TCP connections, you must start up @code{gdbserver} prior to using |
19690 | -the @code{target remote} command. Otherwise you may get an error whose | |
19800 | +the @code{target} command. Otherwise you may get an error whose | |
19691 | 19801 | text depends on the host system, but which usually looks something like |
19692 | 19802 | @samp{Connection refused}. Don't use the @code{load} |
19693 | -command in @value{GDBN} when using @code{gdbserver}, since the program is | |
19694 | -already on the target. | |
19803 | +command in @value{GDBN} when using @code{target remote} mode, since the | |
19804 | +program is already on the target. | |
19805 | + | |
19806 | +@end itemize | |
19695 | 19807 | |
19808 | +@anchor{Monitor Commands for gdbserver} | |
19696 | 19809 | @subsection Monitor Commands for @code{gdbserver} |
19697 | 19810 | @cindex monitor commands, for @code{gdbserver} |
19698 | -@anchor{Monitor Commands for gdbserver} | |
19699 | 19811 | |
19700 | 19812 | During a @value{GDBN} session using @code{gdbserver}, you can use the |
19701 | 19813 | @code{monitor} command to send special requests to @code{gdbserver}. |