[binutils-gdb] [gdb/doc] Improve info line command documentation
Tom de Vries
vries@sourceware.org
Tue Feb 17 14:45:27 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=928e6f5a728f6cb917ee6bdceed45e8f9da7203e
commit 928e6f5a728f6cb917ee6bdceed45e8f9da7203e
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Feb 17 15:45:23 2026 +0100
[gdb/doc] Improve info line command documentation
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
Diff:
---
gdb/doc/gdb.texinfo | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c614e93b812..103549ece77 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -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.
More information about the Gdb-cvs
mailing list