This is the mail archive of the
mailing list for the GDB project.
[OB PATCH] Allow "set sysroot" with no argument
- From: Gary Benson <gbenson at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Thu, 12 Mar 2015 11:50:44 +0000
- Subject: [OB PATCH] Allow "set sysroot" with no argument
- Authentication-results: sourceware.org; auth=none
- References: <54FF1F7C dot 50201 at redhat dot com>
Pedro Alves wrote:
> On 03/10/2015 04:38 PM, Gary Benson wrote:
> > When you start GDB sysroot is set to "", unless you configured it
> > differently. After you set it to something else it doesn't seem
> > possible to restore sysroot to "". Would anyone object to my
> > implementing an "unset sysroot" command?
> Why not just make "set sysroot" (no argument) work? That's the
> first thing that I blindly tried without even thinking about it,
> thinking it'd just work like other commands (below). Did you find
> a good reason that wouldn't be desirable?
Nope. Ok, I've done it. This commit creates the "set/show sysroot"
commands using add_setshow_optional_filename_cmd to allow the sysroot
to be restored to empty after being set.
Pushed as obvious.
Would it be intuitive to automatically add "unset" commands for any
set command that allows no arguments?
* solib.c (_initialize_solib): Make "set/show sysroot" use
add_setshow_optional_filename_cmd so it can be restored to
empty after being set.
gdb/ChangeLog | 6 ++++++
gdb/solib.c | 10 +++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/gdb/solib.c b/gdb/solib.c
index 8417f88..c8138ef 100644
@@ -1590,16 +1590,16 @@ inferior. Otherwise, symbols must be loaded manually, using \
- add_setshow_filename_cmd ("sysroot", class_support,
- &gdb_sysroot, _("\
+ add_setshow_optional_filename_cmd ("sysroot", class_support,
+ &gdb_sysroot, _("\
Set an alternate system root."), _("\
Show the current system root."), _("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
- &setlist, &showlist);
+ &setlist, &showlist);
add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,