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]

[RFA] Add support for catch Ada exceptions (take 2)


> > Hiding the condition is not a big deal. If needed, I can use a bit
> > from the breakpoint flag, don't you think.
> 
> I didn't even know that was there.  Yes, that would be fine.  I would
> recommend separating it into a bitfield, too.

Actually, I found a way without using the flag. I figured using a flag
might be convenient, but is is redundant. I can identify the catchpoints
using their OPS field!

Here is a new iteration of the patch that should be much better. As you
predicted, it made most of the changes to breakpoint.c go away, at a
slight cost in ada-lang.c. The size of the patch is almost identical,
but most of it is contained in one place inside ada-lang.o. Perhaps
we should split this off into a different file, even, but I think this
would make the patch even bigger for little gain for now.

It occurred to me during a last second check that is_known_support_routine
could be simplified a bit. Please do not pay attention to the pc_after_call
and decrement-pc-by-one stuff. I took this code straight of our tree and
it predates a bit all the functions we wrote (I even wrote one of them!).
It's inelegant, but it works. I'll clean this up another rainy day.

Apart from that, I'm pretty happy the way the exercise turned out.

2007-01-02  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.h (ada_find_printable_frame): Remove.
        (ada_exception_catchpoint_p): Add declaration.
        (ada_decode_exception_location): Add declaration.
        (ada_decode_assert_location): Add declaration.
        * ada-lang.c: Add include of annotate.h and valprint.h.
        (exception_catchpoint_kind): New enum.
        (function_name_from_pc): New function.
        (is_known_support_routine): New function.
        (ada_find_printable_frame): New function.
        (ada_unhandled_exception_name_addr): New function.
        (ada_exception_name_addr_1): New function.
        (ada_exception_name_addr): New function.
        (print_it_exception): New function.
        (print_one_exception): New function.
        (print_mention_exception): New function.
        (print_it_catch_exception): New function.
        (print_one_catch_exception): New function.
        (print_mention_catch_exception): New function.
        (catch_exception_breakpoint_ops): New global variable.
        (print_it_catch_exception_unhandled): New function.
        (print_one_catch_exception_unhandled): New function.
        (print_mention_catch_exception_unhandled): New function.
        (catch_exception_unhandled_breakpoint_ops): New global variable.
        (print_it_catch_assert): New function.
        (print_one_catch_assert): New function.
        (print_mention_catch_assert): New function.
        (catch_assert_breakpoint_ops): New global variable.
        (ada_exception_catchpoint_p): New function.
        (error_breakpoint_runtime_sym_not_found): New function.
        (ada_get_next_arg): New function.
        (catch_ada_exception_command_split): New function.
        (ada_exception_sym_name): New function.
        (ada_exception_breakption_ops): New function.
        (ada_exception_catchpoint_cond_string): New function.
        (ada_parse_catchpoint_condition): New function.
        (ada_exception_sal): New function.
        (ada_decode_exception_location): New function.
        (ada_decode_assert_location): New function.
        * breakpoint.c: Add include of ada-lang.h.
        (print_one_breakpoint): Do not print the condition for Ada
        exception catchpoints.
        (create_ada_exception_breakpoint): New function.
        (catch_ada_exception_command): New function.
        (catch_assert_command): New function.
        (catch_command_1): Add support for the new "catch exception" and 
        "catch assert" commands.
        (_initialize_breakpoint): Add help description for the new catch
        commands.
        * Makefile.in (ada-lang.o): Add dependency on annotate.h and
        valprint.h.
        (breakpoint.o): Add dependency on ada-lang.h.

The new testcase:

2006-01-02  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/catch_ex/foo.adb: New file.
        * gdb.ada/catch_ex.exp: New testcase.

Tested on x86-linux. No regression.

OK to apply?  NEWS entry and documentation will follow shortly after
approval.

Thank you,
-- 
Joel


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