From: Simon Marchi Date: Tue, 18 Jun 2019 16:40:13 +0000 (-0400) Subject: doc: fix false claim about second argument to gdb X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4ed4690fc21b1d052092299f820f48694f3ef3eb;p=binutils-gdb.git doc: fix false claim about second argument to gdb Section "Invoking GDB" of the manual states that if you try to launch gdb with: gdb program 1234 it will try to attach to the process with id 1234, unless there is a file named 1234 in the current working directory, in which case it will try to open that file as a core. In fact, when the second argument starts with a digit, GDB tries to attach to process 1234 first, before trying to open file 1234 as a core. So that last remark is not true and therefore this patch removes it. The same remark is present in the man page, so it is removed there too. Section "Choosing Files" correctly states: If the second argument begins with a decimal digit, GDB will first attempt to attach to it as a process, and if that fails, attempt to open it as a corefile. so it is unchanged. Finally, the man page has an additional detail compared to section "Invoking GDB", regarding the use of the -p switch, so I added the same detail to the "Invoking GDB" section. gdb/doc/ChangeLog: * gdb.texinfo (Invoking GDB): Remove sentence about how GDB deals with a file that has the same name as the specified pid to attach to. Add example using -p option. (gdb man): Remove same sentence as in previous item. --- diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f3142fd9ec8..41f57d614cf 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2019-06-18 Simon Marchi + + * gdb.texinfo (Invoking GDB): Remove sentence about how GDB + deals with a file that has the same name as the specified pid to + attach to. Add example using -p option. + (gdb man): Remove same sentence as in previous item. + 2019-06-15 Andrew Burgess * gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9a0320e5d8f..55be2ef6920 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -874,16 +874,17 @@ specified: @value{GDBP} @var{program} @var{core} @end smallexample -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: +You can, instead, specify a process ID as a second argument or use option +@code{-p}, if you want to debug a running process: @smallexample @value{GDBP} @var{program} 1234 +@value{GDBP} -p 1234 @end smallexample @noindent -would attach @value{GDBN} to process @code{1234} (unless you also have a file -named @file{1234}; @value{GDBN} does check for a core file first). +would attach @value{GDBN} to process @code{1234}. With option @option{-p} you +can omit the @var{program} filename. Taking advantage of the second command-line argument requires a fairly complete operating system; when you use @value{GDBN} as a remote @@ -44863,8 +44864,8 @@ You can also start with both an executable program and a core file specified: gdb program core @end smallexample -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: +You can, instead, specify a process ID as a second argument or use option +@code{-p}, if you want to debug a running process: @smallexample gdb program 1234 @@ -44872,9 +44873,8 @@ gdb -p 1234 @end smallexample @noindent -would attach @value{GDBN} to process @code{1234} (unless you also have a file -named @file{1234}; @value{GDBN} does check for a core file first). -With option @option{-p} you can omit the @var{program} filename. +would attach @value{GDBN} to process @code{1234}. With option @option{-p} you +can omit the @var{program} filename. Here are some of the most frequently needed @value{GDBN} commands: