This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [python] Expose some breakpoint operations to Python
On Thursday 23 June 2011 16:56:50, Phil Muldoon wrote:
> Pedro Alves <pedro@codesourcery.com> writes:
>
> > On Thursday 23 June 2011 15:46:14, Phil Muldoon wrote:
>
> > No plan yet. I just started out by adding a single breakpoint_ops instance
> > that handles all breakpoint types that currently aren't using breakpoint_ops,
> > and moving all default actions to the corresponding callback. This would
> > be straightforward if the API is a good fit. But take a look at
> > the fallback code in print_one_breakpoint_location, and print_one_breakpoint.
> > Breakpoints with multiple locations are handled a bit differently than
> > just a fallbach, with multiple calls to print_one_breakpoint. Maybe
> > we could move all that !print_one code inside the new print_one
> > callback?
>
> 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);
}
> 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.
--
Pedro Alves