]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/readline: add readline library version to 'show configuration'
authorAndrew Burgess <aburgess@redhat.com>
Wed, 30 Oct 2024 11:44:23 +0000 (11:44 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 12 Nov 2024 13:58:19 +0000 (13:58 +0000)
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.

gdb/NEWS
gdb/doc/gdb.texinfo
gdb/testsuite/gdb.base/maint.exp
gdb/top.c

index 38efc3b543afc51127af4a548287436e2082aa87..20837bb7b1795e0803056949e3ab880b6e1ba0f2 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -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
index 53f41e674449981d781b7e4b04f74e5764754d8e..99720f1206e90facf7ffdb27dc5cc06ffd9eec52 100644 (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
index d6aa22321f1c0e364a03212619722a5863229ee7..f1e1b8774807423a73b265583a3e0119172c76fc 100644 (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
index 45261c8f2a561c6abda0f707bfdba296ded0e1d1..d750f3305f2eef7c5a30cef7f647537916a80499 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -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
+             );
 }
 \f