[patch] [python] Expose some breakpoint operations to Python

Phil Muldoon pmuldoon@redhat.com
Thu Jun 23 18:58:00 GMT 2011


Pedro Alves <pedro@codesourcery.com> writes:

> On Thursday 23 June 2011 16:56:50, Phil Muldoon wrote:

>> Yes the multiple locations thing is a bit weird.  But from (my Python)
>> point of view, that is an internal abstraction that the Python glue code
>> will absorb.  I don't think this will affect Python API users too much.
>
> What happens if you create a python breakpoint that ends up
> with multiple locations?  Don't you end up tripping on this
> assertion?
>
>   /* 5 and 6 */
>   if (b->ops != NULL && b->ops->print_one != NULL)
>     {
>       /* Although the print_one can possibly print all locations,
> 	 calling it here is not likely to get any nice result.  So,
> 	 make sure there's just one location.  */
>       gdb_assert (b->loc == NULL || b->loc->next == NULL);
>       b->ops->print_one (b, last_loc);
>     }

Well to be fair, any breakpoint that implements breakpoint_ops will
(including catchpoints).  I guess the point there is that they won't, or
are not likely to encounter this.  Fair point.  Actually I should have
tested for this very scenario, so I will add it to the Python
tests. What we could do is if a breakpoint has multiple locations just
don't call this routine, or alter the logic to raise something less
aggressive than an assert.  But you have convinced me that breakpoint
ops need a good going over.  Any function, internal or external, that
lets the user create a perfectly legitimate breakpoint, then later
causes GDB to give up, because it does not how to handle it is bogus.

>> But I take your point.  I'm trying to position this patch so that users
>> can access a limited subset of printing breakpoint operations. The
>> time-line is important here too.  If this refactoring internally is just
>> going to take a few weeks, hey, no big deal, I can just wait and
>> adjust.  But if it is a long term thing, I think we could expose the
>> limited functionality we expose now.
>
> I'd like to finish that conversion soon.

I really look forward to it!  In the meantime I will check-in the patch
to a git branch on archer, and keep it updated.  If the breakpoint ops
refactoring turns into a deep-dark hole, we can always later do something
like the above in solving it.

Cheers,

Phil  



More information about the Gdb-patches mailing list