On Tue, Jan 10, 2012 at 6:17 PM, Eli Zaretskii wrote: >> From: Kevin Pouget >> Date: Tue, 10 Jan 2012 15:50:30 +0100 >> Cc: gdb-patches@sourceware.org, pmuldoon@redhat.com >> >> > In any case, the last 2 sentences sound scary: I could interpret them >> > as meaning I cannot trust the locations at all.  If that is indeed so, >> > what use are they? >> >> that's already discussed above, but I don't want you to be scared, so >> let me explain what I meant: >> it's not "at any moment", but rather "after any call to GDB's Python >> interface". We may want to say that it's only breakpoint or >> execution-related calls, but _I_ can't ensure that this is true, and >> it 'might' change in the future: >> >> > A @code{gdb.BpLocation} object may be invalidated during >> > any call to @{GDB}'s API for internal reasons (for instance, but not limited to, >> > breakpoint or execution-related mechanisms). > > Sounds okay to me.  But you don't need "but not limited to", because > "for instance" already says that. > >> +Return a tuple containing a sequence of @code{gdb.BpLocation} objects >> +(see below) associated with this breakpoint.  A breakpoint with no location >> +is a pending breakpoint (@xref{Set Breaks, , pending breakpoints}). >                            ^^^^^ > Still an @xref... sorry, I missed it in the first run ... >> +any call to @{GDB}'s API for internal reasons (for instance, but not limited to, >               ^^^^^^ > You already know what to fix here... > > The documentation parts are OK with those changes. Thanks, I've fixed these parts - I've also improved watchpoint handling by adding a regression test (nothing fancy so far, I just ensure that the location object has the right properties. I couldn't find in the documentation any corner cases that worth being tested). I also adapted the BpLocation.address attribute to cast the address to the watchpoint type (value_type (wp->val)) if relevant. Let me know if there are more situations where WP handling can differ from BP handling, regarding their locations at least. Cordially, Kevin Tested with no regression on f15/x64 -- 2012-01-11 Kevin Pouget 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. * breakpoint.c (free_bp_location): Call gdbpy_bplocation_free. * 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. * python/python.c (gdbpy_bplocation_free): New empty stub. (_initialize_python): Call gdbpy_initialize_bplocation. * python/python.h (gdbpy_bplocation_free): New prototype. doc/ * gdb.texinfo (Breakpoints In Python): Document gdb.Breakpoint.locations and gdb.BpLocation. testsuite/ * gdb.python/py-breakpoint.exp: Test gdb.BpLocation.