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: [python][patch] Inferior and Thread information support.


>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> I'm not sure that conversion from a Python type to a buffer object are
Phil> that transparent.  For instance there seems to be no straightforward
Phil> way to represent 3.141 as a sequence of bytes backed by a buffer in
Phil> Python (or accessible via the buffer interface rather).  Maybe there
Phil> is, I'm certainly not a Python language expert.  I hope someone can
Phil> prove me wrong!

Yeah, there are some things in Python for this.  See the 'struct'
module.

I think it is somewhat better to keep our API simple and rely on the
built-in library for more complicated things.  Sorry about that.

Phil> Right now with the existing code, we take 3.141 as a gdb.value and
Phil> convert that to bytes via value_contents. Your suggestions would
Phil> certainly make the existing code simpler (and my porting task a little
Phil> easier ;), but I can't help thinking that it would be just making the
Phil> user jump through extra hoops just for API pureness.  I strive for
Phil> that, it's a good thing; it just strikes me a little too much in this
Phil> case.  OTOH we could just make add_value_pattern available via the API
Phil> and have the user manually do the conversion "the GDB way".

Arguably, gdb.Value should support the buffer protocol.  I don't know if
that is directly possible, but if not we should supply a way to convert
a Value to a buffer -- to give the user a way to view the underlying
bits.

I think you should just remove the max_count argument.  It seems weird
to me.  If people want multiple searches, it is easy to iterate.  Or, if
we really want to support multiple searches, then I think we should do
it by returning an iterator instead of a list.

Tom


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