gdb/readline: add readline library version to 'show configuration'

When debugging readline issues I'd like an easy way to know (for sure)
what version of readline GDB is using.  This could also be useful when
writing readline tests, knowing the precise readline version will
allow us to know if we expect a test to pass or not.

Add the readline library version to the output of the 'show
configuration' command.  Also include a suffix indicating if we are
using the system readline, or the statically linked in readline.

The information about static readline vs shared readline can be
figured out from the configure command output, but having it repeated
in the readline version line makes it super easy to grok within tests,
and it's super cheap, so I don't see this as a problem.
This commit is contained in:
Andrew Burgess 2024-10-30 11:44:23 +00:00
parent 1048062a3f
commit b0c6153ccf
4 changed files with 26 additions and 0 deletions

View File

@ -140,6 +140,9 @@ maintenance print remote-registers
which registers were included in the last stop reply packet received by
GDB.
show configuration
Now includes the version of GNU Readline library that GDB is using.
* New remote packets
vFile:stat

View File

@ -2491,6 +2491,7 @@ Display information about permission for copying @value{GDBN}.
Display the @sc{gnu} ``NO WARRANTY'' statement, or a warranty,
if your version of @value{GDBN} comes with one.
@anchor{show configuration}
@kindex show configuration
@item show configuration
Display detailed information about the way @value{GDBN} was configured
@ -2500,6 +2501,11 @@ automatically by @command{configure}. When reporting a @value{GDBN}
bug (@pxref{GDB Bugs}), it is important to include this information in
your report.
This commands also displays the version number of the Readline library
that @value{GDBN} is using. After the version number will appear
either @samp{(system)} indicating @value{GDBN} is using the shared
system Readline library, or @samp{(internal)} indicating @value{GDBN}
is using a statically linked in version of the Readline library.
@end table
@node Running
@ -27534,6 +27540,10 @@ This command accepts the current line for execution and fetches the
next line relative to the current line from the history for editing.
Any argument is ignored.
It is possible to discover which version of Readline @value{GDBN} is
using with the @kbd{show configuration} command (@pxref{show
configuration}).
@node Command History
@section Command History
@cindex command history

View File

@ -381,6 +381,9 @@ gdb_test "maint" \
"List.*unambiguous\\..*" \
"maint w/o args"
gdb_test "show configuration" \
"^This GDB was configured as follows:\r\n.*\r\nGNU Readline library version: \[^\r\n\]+"
# Test that "main info line-table" w/o a file name shows the symtab for
# $srcfile.
set saw_srcfile 0

View File

@ -1601,6 +1601,16 @@ This GDB was configured as follows:\n\
(\"Relocatable\" means the directory can be moved with the GDB installation\n\
tree, and GDB will still find it.)\n\
"));
gdb_printf (stream, "\n");
gdb_printf (stream, _("GNU Readline library version: %s\t%s\n"),
rl_library_version,
#ifdef HAVE_READLINE_READLINE_H
"(system)"
#else
"(internal)"
#endif
);
}