Re: [rfc breakpoint] Catch exceptions

Andrew Cagney
2003-03-25T16:05:19Z

> I'm just looking for feedback on this patch. It's mostly complete except
> for some mass re-indenting that some of the changes would require; I'm not
> entirely happy with the design yet though, so I'm looking for comments.

If you're not happy with a design, the best thing to do is toss it on a
branch where it can incubate a little.

> The basic idea is that these "catchpoints" are just normal breakpoints and
> should be handled as such. But we'd like to print them a little
> differently, for clarity.

> Here's the interesting bit, from struct breakpoint:

This is the more interesting bit:

+ enum {ep_normal, ep_gnuv2, ep_gnuv3} ep_type;

You're expecting multiple implementations ...

> + enum print_stop_action (*print) (struct breakpoint *);
> +
> + void (*print_one) (struct breakpoint *, CORE_ADDR *);
> +
> + void (*print_mention) (struct breakpoint *);

Per frame-unwind, instead put these virutal methods in their own struct
and then point the breakpoint at it. Separate v2 and v3 catchpoints (in
separate files?) will then be possible (and make the enum unnecessary).

Long term, the `breakpoint' code should do everything via these virtual
methods. If a breakpoint is hit, the corresponding handler should be
called.

Those methods should rely on zero globals - pass everything in.

Some nits:

Just write this:
+ (*b->print_mention) (b);
like:
b->print_mention (b)
While I know some kernel groups like to use that style, GDB doesn't
appear to.

This, and related, should be submitted separatly:
+extern struct symtab_and_line find_msymbol_start_sal (struct
minimal_symbol *,
+ int);

Any chance of a comment?

Andrew