]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/doc] Improve info line command documentation
authorTom de Vries <tdevries@suse.de>
Tue, 17 Feb 2026 14:45:23 +0000 (15:45 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 17 Feb 2026 14:45:23 +0000 (15:45 +0100)
The "info line" command can be used with or without arguments.

About using it without arguments, the documentation [1] says the following:
...
info line

    With no locspec, information about the current source line is printed.

  ...

After info line, using info line again without specifying a location will
display information about the next source line.
...

That does not describe the fact that the command may also show the last line
listed:
...
(gdb) info line
No line number information available.
(gdb) list main
20 #include "interps.h"
21 #include "run-on-main-thread.h"
22
23 int
24 main (int argc, char **argv)
25 {
26   /* The first call to is_main_thread () should be from the main thread.
27      If this is the first call, then that requirement is fulfilled here.
28      If this is not the first call, then this verifies that the first call
29      fulfilled that requirement.  */
(gdb) info line
Line 29 of "gdb/gdb.c" is at address 0x419684 <main(int, char**)+30>
   but contains no code.
(gdb)
...

Update the documentation to list this additional functionality.

Approved-By: Eli Zaretskii <eliz@gnu.org>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33783

[1] https://www.sourceware.org/gdb/current/onlinedocs/gdb.html/Machine-Code.html#index-info-line

gdb/doc/gdb.texinfo

index c614e93b812ef089553a209719fc1cab09227c94..103549ece778c5ef6c02f5a2336419d02c307de2 100644 (file)
@@ -10319,8 +10319,17 @@ Print the starting and ending addresses of the compiled code for the
 source lines of the code locations that result from resolving
 @var{locspec}.  @xref{Location Specifications}, for the various forms
 of @var{locspec}.
-With no @var{locspec}, information about the current source line is
-printed.
+
+With no @var{locspec}, information is printed about either:
+@itemize @bullet
+@item
+the last line listed (@pxref{List})
+@item
+the line after the line shown by the previous @code{info line} command
+(@pxref{info-line-repeated-calls, ,info line@comma{} repeated calls})
+@item
+the current source line
+@end itemize
 @end table
 
 For example, we can use @code{info line} to discover the location of
@@ -10355,6 +10364,7 @@ convenience variable @code{$_} (@pxref{Convenience Vars, ,Convenience
 Variables}).
 
 @cindex info line, repeated calls
+@anchor{info-line-repeated-calls}
 After @code{info line}, using @code{info line} again without
 specifying a location will display information about the next source
 line.