Re: Extending gdb.Value

Joel Borggrén-Franck
2010-09-29T15:18:20Z

On Fri, Sep 24, 2010 at 9:28 AM, Joel Borggrén-Franck
<joel.borggren.franck@gmail.com> wrote:
> So I noticed today that I cant extend gdb.Value:
>

The fix for this is trivial:

--- gdb-7.2-orig/gdb/python/py-value.c 2010-06-28 23:16:03.000000000 +0200
+++ gdb-7.2/gdb/python/py-value.c 2010-09-29 13:33:00.000000000 +0200
@@ -1156,7 +1156,7 @@
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /*tp_flags*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE,
/*tp_flags*/
"GDB value object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */

I'm convinced this is a good idea. I got lots of stuff I would like to
add on top of gdb.Value that only makes sense in the context of
specific applications.

So how can I test that this doesn't break anything? And which other
python types are suitable for being bases. Why not add all of them?

Cheers
/Joel