From: Pedro Alves <palves@redhat.com>
To: Gabriel Krisman Bertazi <gabriel@krisman.be>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.
Date: Wed, 27 Aug 2014 11:56:00 -0000 [thread overview]
Message-ID: <53FDC751.3000902@redhat.com> (raw)
In-Reply-To: <878umgaqjk.fsf@krisman.be>
Hi Gabriel,
On 08/23/2014 03:27 AM, Gabriel Krisman Bertazi wrote:
> Pedro Alves <palves@redhat.com> 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
next prev parent reply other threads:[~2014-08-27 11:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 6:12 Gabriel Krisman Bertazi
2014-08-21 15:53 ` Pedro Alves
2014-08-23 2:27 ` Gabriel Krisman Bertazi
2014-08-27 11:56 ` Pedro Alves [this message]
2014-08-31 18:35 ` Gabriel Krisman Bertazi
2014-09-02 12:52 ` Pedro Alves
2014-09-04 19:26 ` Gabriel Krisman Bertazi
2014-09-04 19:57 ` Sergio Durigan Junior
2014-09-05 13:12 ` Pedro Alves
2014-09-08 0:44 ` Gabriel Krisman Bertazi
2014-09-09 21:19 ` Sergio Durigan Junior
2014-08-21 21:20 ` Sergio Durigan Junior
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=53FDC751.3000902@redhat.com \
--to=palves@redhat.com \
--cc=gabriel@krisman.be \
--cc=gdb-patches@sourceware.org \
/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