[PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.
Gabriel Krisman Bertazi
gabriel@krisman.be
Sat Aug 23 02:27:00 GMT 2014
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 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).
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":
Using the verification for cfunc/sfunc above, also avoids
printing the "user-defined" line.
Thanks,
--
Gabriel Krisman Bertazi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20140823/f356a33a/attachment.sig>
More information about the Gdb-patches
mailing list