This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Python API: can I make new prefix Parameters?
- From: Evan Driscoll <evaned at gmail dot com>
- To: gdb at sourceware dot org
- Date: Wed, 22 Jul 2015 20:10:28 -0500
- Subject: Python API: can I make new prefix Parameters?
- Authentication-results: sourceware.org; auth=none
I'd like to make some settings divided into buckets with prefix
commands. I've included one such attempt below and have tried a bunch
of variants on it, but I just get the error "RuntimeError: 'test-pfx'
is not a prefix command." when it gets loaded by GDB. (I've even tried
adding a prefix Command with the name test-pfx to no avail.)
What I *can* do is add a new Parameter to an existing prefix, e.g. I
can make a 'print test-param' Parameter that seems to do what I want.
Maybe what I want isn't possible under the current API?
Here is my test program:
import gdb
class Prefix(gdb.Parameter):
"""The Prefix"""
def __init__(self):
super(Prefix, self).__init__(
"test-pfx",
gdb.COMMAND_DATA,
gdb.PARAM_AUTO_BOOLEAN)
pfx = Prefix()
class TestParameter(gdb.Parameter):
"""The Parameter"""
def __init__(self):
super(TestParameter, self).__init__(
"test-pfx test-param",
gdb.COMMAND_DATA,
gdb.PARAM_ENUM,
["one", "two", "three"])
self.value = "one"
param = TestParameter()
(Changing "test-pfx test-param" to "print test-param", as I mentioned
above, makes it work.)
Thanks,
Evan