Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <palves@redhat.com>
Subject: [OB PATCH] Allow "set sysroot" with no argument
Date: Thu, 12 Mar 2015 11:50:00 -0000	[thread overview]
Message-ID: <1426161044-22091-1-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <54FF1F7C.50201@redhat.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?

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


      reply	other threads:[~2015-03-12 11:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Gary Benson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426161044-22091-1-git-send-email-gbenson@redhat.com \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox