public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* set sysroot foo cannot be undone
@ 2015-03-10 16:38 Gary Benson
  2015-03-10 16:44 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Benson @ 2015-03-10 16:38 UTC (permalink / raw)
  To: gdb-patches

Hi all,

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?

Cheers,
Gary

-- 
http://gbenson.net/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: set sysroot foo cannot be undone
  2015-03-10 16:38 set sysroot foo cannot be undone Gary Benson
@ 2015-03-10 16:44 ` Pedro Alves
  2015-03-12 11:50   ` [OB PATCH] Allow "set sysroot" with no argument Gary Benson
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2015-03-10 16:44 UTC (permalink / raw)
  To: Gary Benson, gdb-patches

On 03/10/2015 04:38 PM, Gary Benson wrote:
> Hi all,
> 
> 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?

$ gdb
GNU gdb (GDB) 7.9.50.20150309-cvs
...
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "/usr/lib/debug".
(gdb) set debug-file-directory
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "".

...

(gdb) show args
Argument list to give program being debugged when it is started is "".
(gdb) set args foo
(gdb) show args
Argument list to give program being debugged when it is started is "foo".
(gdb) set args
(gdb) show args
Argument list to give program being debugged when it is started is "".

...

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [OB PATCH] Allow "set sysroot" with no argument
  2015-03-10 16:44 ` Pedro Alves
@ 2015-03-12 11:50   ` Gary Benson
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Benson @ 2015-03-12 11:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pedro Alves

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-12 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 16:38 set sysroot foo cannot be undone Gary Benson
2015-03-10 16:44 ` Pedro Alves
2015-03-12 11:50   ` [OB PATCH] Allow "set sysroot" with no argument Gary Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).