From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21290 invoked by alias); 12 Mar 2015 11:50:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21233 invoked by uid 89); 12 Mar 2015 11:50:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 12 Mar 2015 11:50:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2CBok32008174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 12 Mar 2015 07:50:46 -0400 Received: from blade.nx (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2CBojVu016480; Thu, 12 Mar 2015 07:50:46 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id D33A0265071; Thu, 12 Mar 2015 11:50:44 +0000 (GMT) From: Gary Benson To: gdb-patches@sourceware.org Cc: Pedro Alves Subject: [OB PATCH] Allow "set sysroot" with no argument Date: Thu, 12 Mar 2015 11:50:00 -0000 Message-Id: <1426161044-22091-1-git-send-email-gbenson@redhat.com> In-Reply-To: <54FF1F7C.50201@redhat.com> References: <54FF1F7C.50201@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00337.txt.bz2 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