This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[OB PATCH] Allow "set sysroot" with no argument


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?

Cheers,
Gary

---
gdb/ChangeLog:

	* 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
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1590,16 +1590,16 @@ inferior.  Otherwise, symbols must be loaded manually, using \
 			   show_auto_solib_add,
 			   &setlist, &showlist);
 
-  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\
 `set solib-search-path'."),
-			    reload_shared_libraries,
-			    NULL,
-			    &setlist, &showlist);
+				     reload_shared_libraries,
+				     NULL,
+				     &setlist, &showlist);
 
   add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
 		 &setlist);
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]