This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [rfc] expose gdb values to python


(Sorry I am participating so late in the discussion, but I am still
recovering from my summer, and only recently managed to learn some Python)

> The underlying question is what type model Value presents.  If a Value
> has a derived type, should we be able to access fields of the base
> class using v["f"]?  Or should we need v["Base"]["f"]?

My initial reaction to this question is that the Value object
should follow the same semantics as the debugger. For instance,
if class Foo inherits from class Bar, then any component of class
Bar should be directly visible from class Foo. So if X is Value
of type class Foo, and class Bar has a component named "Baz",
then I should be able to access that component with X["Baz"].

Better yet, I would love for the object to have one attribute
for each component that I could simply access using X.baz.
But I suspect that there is no way we can implement that without
having to compute the value of each component, which would be
quite wastful the vast majority of the time. Sigh, is it not
possible to lazy-initialize attributes?

-- 
Joel


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