From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7748 invoked by alias); 27 Aug 2014 11:56:09 -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 7721 invoked by uid 89); 27 Aug 2014 11:56:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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; Wed, 27 Aug 2014 11:56:08 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7RBu3Ln020987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Aug 2014 07:56:03 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7RBu1Tp013130; Wed, 27 Aug 2014 07:56:03 -0400 Message-ID: <53FDC751.3000902@redhat.com> Date: Wed, 27 Aug 2014 11:56:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Gabriel Krisman Bertazi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies. References: <1408515134-31165-1-git-send-email-gabriel@krisman.be> <53F615D8.5000901@redhat.com> <878umgaqjk.fsf@krisman.be> In-Reply-To: <878umgaqjk.fsf@krisman.be> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-08/txt/msg00565.txt.bz2 Hi Gabriel, On 08/23/2014 03:27 AM, Gabriel Krisman Bertazi wrote: > Pedro Alves writes: > >>> c = lookup_cmd (&comname, cmdlist, "", 0, 1); >>> - /* c->user_commands would be NULL if it's a python/scheme command. */ >>> - if (c->class != class_user || !c->user_commands) >>> - error (_("Not a user command.")); >>> + if (c->class != class_user) >>> + error (_("Not a user command.")); >> >> Doesn't this mean this reverts part of 7d74f2446, and thus now we'd >> show python/scheme commands? >> >> IIUC 7d74f2446, it looks like gdb.python/py-cmd.exp is missing >> a test that makes sure "show user" doesn't list the user-defined python command. >> >> (hmm, this "show user" vs "help user-defined" difference isn't very >> intuitive) > > Hello Pedro, > > Thanks for your review. > > Indeed, this means we'd start to show python/scheme commands, but I > wasn't aware of commit 7d74f2446. I found it by noticing you were removing the "c->user_commands would be NULL if it's a python/scheme command" comment, and using "git blame" to find out why that comment was there in the first place. > > I don't see that as a problem, because python/scheme are also user > commands (or, at least, are part of class_user class). Considering that > "help user-defined" also shows python/scheme commands, I believe it > would be more practical to just list them on "show user" (should we > update the doc string, as well). I think we'll need to track down the original discussion, and ask whoever was involved. Otherwise, we'd just be going in circles. :-) E.g., that commit changed the online help and the manual to try to make that clear. (gdb) help show user Show definitions of non-python/scheme user defined commands. Argument is the name of the user defined command. With no argument, show definitions of all user defined commands. > Either way, the "Not a user command" error message is quite misleading > for python/scheme commands, though. > > If you disagree, I'd be happy to update the patch to rely on another > condition to avoid printing python/scheme commands. > c->function.cfunc/sfunc == NULL seems to work pretty well to avoid > printing python commands. > > What do you think? > >> What is this printing now ? > > Now, it prints: > > (gdb) show user > User command "emptycmd": > User command "cmd1": > print "Hello" > > User command "python-hello": > User command "user-defined": > The question was actually in context of the gdb.base/default.exp change: > --- a/gdb/testsuite/gdb.base/default.exp > +++ b/gdb/testsuite/gdb.base/default.exp > @@ -693,7 +693,7 @@ gdb_test "show prompt" "Gdb's prompt is \"$gdb_prompt \".*" "show prompt" > #test show radix > gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix" > #test show user > -gdb_test_no_output "show user" "show user" > +gdb_test "show user" "User command \"user-defined\".*" "show user" What are we showing now by default? > Using the verification for cfunc/sfunc above, also avoids > printing the "user-defined" line. Hmm, but what is that "user-defined" command ? Thanks, Pedro Alves