This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Subclassing gdb.Value

On Sat, Feb 7, 2009 at 4:02 PM, Tom Tromey <> wrote:
> Jim> However, gdb.Value doesn't have Py_TPFLAGS_BASETYPE set.  Could
> Jim> someone give me a heads-up about what sorts of problems I'm liable to
> Jim> encounter if I try to make this work?
> The core expects to be able to extract a struct value from a gdb.Value.
> So, you would need to create the struct value when constructing a new
> Value from Python.  That's the only tricky bit I can think of.

Won't calling super().__init__ take care of creating the struct value,
just as calling gdb.Value does now?  If a subclass doesn't call its
superclass's __init__, then it just loses.  It should lose gracefully,
of course.

> In other places I've just relied on duck typing... e.g., for the
> pluggable "backtrace", some filters return objects that supply all the
> frame methods.  I assume that isn't enough in your case since
> presumably you want the core to convert your sub-Value to a gdb value
> automatically.  Maybe there's some other way we could solve that.

Yes; I'd like to be able to use instances of my subclasses anywhere in
the API a gdb.Value can be used.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]