diff options
author | Tom Tromey <tromey@adacore.com> | 2024-11-13 08:49:53 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-11-21 14:08:18 -0700 |
commit | 29e316d8b15f1f1874bb58d8cd8346629f4edcc4 (patch) | |
tree | d7176c1d26d62c6c68676dc009a28052c375d2b0 | |
parent | 978324718990b6b371d4eeeba02cfe13a0ebf120 (diff) | |
download | binutils-29e316d8b15f1f1874bb58d8cd8346629f4edcc4.zip binutils-29e316d8b15f1f1874bb58d8cd8346629f4edcc4.tar.gz binutils-29e316d8b15f1f1874bb58d8cd8346629f4edcc4.tar.bz2 |
Don't put JIT_READER_DIR into help text
The 80-column-help-string self-test can fail if gdb's install
directory is too long, because the help for "jit-reader-load" includes
JIT_READER_DIR.
This help text is actually somewhat misleading, though.
JIT_READER_DIR is not actually used directly -- instead the relocated
variant is used.
This patch adds a new "show jit-reader-directory" command and changes
the help text to refer to this instead. I considered adding a "set"
command as well, but since absolute paths are acceptable here, and
since this is a very niche command anyway, I figured there was no need
to bother.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32357
Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
-rw-r--r-- | gdb/NEWS | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 4 | ||||
-rw-r--r-- | gdb/jit.c | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/jit-reader.exp | 4 |
4 files changed, 31 insertions, 2 deletions
@@ -94,6 +94,10 @@ * New commands +show jit-reader-directory + Show the name of the directory that "jit-reader-load" uses for + relative file names. + set style line-number foreground COLOR set style line-number background COLOR set style line-number intensity VALUE diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 99720f1..b91b5d6 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -40047,6 +40047,10 @@ reporting an error. A new JIT reader can be loaded by first unloading the current one using @code{jit-reader-unload} and then invoking @code{jit-reader-load}. +@item show jit-reader-directory +This command will show the directory that is used by +@code{jit-reader-load} when a relative file name is specified. + @item jit-reader-unload Unload the currently loaded JIT reader. @@ -28,6 +28,7 @@ #include "filenames.h" #include "frame-unwind.h" #include "cli/cli-cmds.h" +#include "cli/cli-style.h" #include "gdbcore.h" #include "inferior.h" #include "observable.h" @@ -1298,6 +1299,16 @@ jit_event_handler (gdbarch *gdbarch, objfile *jiter) } } +/* Implementation of "show jit-reader-directory". */ + +static void +show_jit_reader_directory (const char *args, int from_tty) +{ + gdb_printf (_("JIT reader directory is %ps.\n"), + styled_string (file_name_style.style (), + jit_reader_dir.c_str ())); +} + void _initialize_jit (); void _initialize_jit () @@ -1329,8 +1340,8 @@ _initialize_jit () Load FILE as debug info reader and unwinder for JIT compiled code.\n\ Usage: jit-reader-load FILE\n\ Try to load file FILE as a debug info reader (and unwinder) for\n\ -JIT compiled code. The file is loaded from " JIT_READER_DIR ",\n\ -relocated relative to the GDB executable if required.")); +JIT compiled code. If FILE is not an absolute file name, it is found\n\ +relative to a built-in directory. See \"show jit-reader-directory\".")); set_cmd_completer (c, deprecated_filename_completer); c = add_com ("jit-reader-unload", no_class, @@ -1339,5 +1350,11 @@ Unload the currently loaded JIT debug info reader.\n\ Usage: jit-reader-unload\n\n\ Do \"help jit-reader-load\" for info on loading debug info readers.")); set_cmd_completer (c, noop_completer); + + add_cmd ("jit-reader-directory", class_obscure, + show_jit_reader_directory, + _("Show the JIT reader directory.\n\ +This is the directory used by \"jit-reader-load\" when given\n\ +a relative file name."), &showlist); } } diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp index 62f6af2..2a96207 100644 --- a/gdb/testsuite/gdb.base/jit-reader.exp +++ b/gdb/testsuite/gdb.base/jit-reader.exp @@ -109,6 +109,10 @@ proc jit_reader_test {} { gdb_test_no_output "set debug jit 1" } + # Just test that this is installed and prints something. + gdb_test "show jit-reader-directory" \ + "JIT reader directory is .*\\." + gdb_test_no_output "jit-reader-load ${jit_reader_bin}" "jit-reader-load" gdb_run_cmd gdb_test "" "Program received signal SIGTRAP, .*" "expect SIGTRAP" |