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: [PATCH] Add bp_location to Python interface


> On Fri, Mar 30, 2012 at 9:51 PM, Tom Tromey <tromey@redhat.com>
> wrote:

> On 04/03/2012 11:34 AM, Kevin Pouget wrote:

> the idea here was that a tuple is not mutable, whereas a list is --
>  () vs. []. I've removed the tuple, although although I'm not sure
>  when I'm supposed to use the List or the Tuple.

This was my comment way back when, so apologies for the conflicting
comments.  I prefer to return non-mutable objects when they reflect an
internal state of GDB; just to provide a hint that the data exchange
is one-way -- that changing the list won't change state back in GDB
(hence the immutable tuple).

Though I suspect it does not really matter -- the user can quite
easily turn a tuple into a list.  As for returning a tuple versus a
list, again, I guess it does not really matter; the tuple idiom
was just my convention (though with very large lists, the conversion
to a tuple might be expensive).


> 2012-03-04 Kevin Pouget <kevin.pouget@st.com>
>
> Add bp_location to Python interface
> * Makefile.in (SUBDIR_PYTHON_OBS): Add py-bploc.o
> (SUBDIR_PYTHON_SRCS): Add python/py-bploc.c
> Add build rule for this file.
> * breakpoint.h (struct bploc_object): Forward declaration.
> (struct bp_location): Add py_bploc_obj.
> * python/py-bploc.c: New file.
> * python/py-breakpoint.c (bppy_locations): New function.
> (breakpoint_object_methods): New method binding: locations().
> * python/python-internal.h (bploc_object): New typedef.
> (bplocation_to_bplocation_object): New prototype.
> (gdbpy_initialize_bplocation): Likewise.
>
> doc/
> Add bp_location to Python interface
> * gdb.texinfo (Breakpoints In Python): Document
> gdb.Breakpoint.locations and gdb.BpLocation.
>
>
> testsuite/
> Add bp_location to Python interface
> * gdb.python/py-breakpoint.exp: Test gdb.BpLocation.

Thanks for this,

Cheers

Phil


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