[PATCH] Add support for `user-defined` python commands

Doug Evans dje@google.com
Thu May 19 01:59:00 GMT 2011


On Wed, May 18, 2011 at 4:26 PM, Scott J. Goldman <scottjg@vmware.com> wrote:
> For codebases with a large pre-existing set of legacy gdb macros, it's
> nice to be able to use `help user-defined`, to refresh your memory wrt
> to existing macros. Currently, python gdb commands can't put themselves
> under the `user-defined` category. This patch aims to rectify that.

I think there's a problem to solve here (finding one's way in the
myriad of available commands), but I'm not sure this is the way to go.
[Maybe it is though.]

What does "help user-defined" buy?
It *does* buy a way to see a list of a particular set of available
commands, but the list isn't categorized along functional lines (like
managing breakpoints or examining data).  What the user will get is a
list of a random set of commands.

For completeness sake, prefix commands provide another way of
categorizing commands - one *could* put a set of new commands in a
prefix command, and then "help <prefix>" would list all of the
commands.  But it doesn't always fit what one wants to do.  E.g. it
wouldn't list anything added as a set/show or info command (python
commands mightn't be able to be implemented as set/show/info today, I
forget, but it seems like a useful thing to at least not preclude).

Question: What if we had the ability to add new command classes?
And what if "help <foo>"  could print all the commands in that command class?
Then one could add a whole suite of python commands to deal with foo
(which needn't necessarily match any existing command class), and
"help foo" would list them all.

Just a thought.



More information about the Gdb-patches mailing list