From a38118e5d165324b4f9509fd82cf1f1c6421bfc5 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 9 Jul 2019 19:26:16 +0100 Subject: Make "maint info breakpoints" show "catch catch/throw/rethrow" locations This commit makes "maint info breakpoints" show the internal locations of C++ exception catchpoints: (gdb) info breakpoints Num Type Disp Enb Address What 2 catchpoint keep y exception catch With multiple locations: (gdb) maint info breakpoints Num Type Disp Enb Address What 2 catchpoint keep y exception catch 2.1 y 0x000000000040545f <__cxa_begin_catch+95> inf 1 2.2 y 0x00007ffff71dbe0f <__cxxabiv1::__cxa_begin_catch(void*)+95> inf 1 (gdb) With a single location: (gdb) maint info breakpoints 2 Num Type Disp Enb Address What 2 catchpoint keep y exception catch inf 1 2.1 y 0x00007ffff7bc0b7f <__cxa_begin_catch+95> inf 1 With no locations: (gdb) maint info breakpoints 2 Num Type Disp Enb Address What 2 catchpoint keep y exception catch inf 1 Other catchpoints still show the same way, here a catch signal: (gdb) info breakpoints Num Type Disp Enb Address What 3 catchpoint keep y signal "" (gdb) maint info breakpoints Num Type Disp Enb Address What 3 catchpoint keep y signal "" inf 1 (gdb) Note: I considered making the locations be printed from within breakpoint_ops::print_one(), but gave up given the handling for the broken MI v2 output: /* The mi2 broken format: the main breakpoint tuple ends here, the locations are outside. */ if (!use_fixed_output) bkpt_tuple_emitter.reset (); in print_one_breakpoint. gdb/ChangeLog: 2019-07-09 Pedro Alves * break-catch-throw.c (is_exception_catchpoint): New. * breakpoint.c (print_one_breakpoint_location): New parameter 'raw_loc'. Handle it. Use is_watchpoint/is_catchpoint/is_exception_catchpoint instead of looking at the breakpoint's type. (print_one_breakpoint): If handling "maint info breakpoints", also print locations of exception catchpoints. * breakpoint.h (is_exception_catchpoint): Declare. --- gdb/breakpoint.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index bcfa45b..e25acfa 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -872,6 +872,11 @@ extern int is_breakpoint (const struct breakpoint *bpt); extern int is_watchpoint (const struct breakpoint *bpt); +/* Return true if BPT is a C++ exception catchpoint (catch + catch/throw/rethrow). */ + +extern bool is_exception_catchpoint (breakpoint *bp); + /* An instance of this type is used to represent all kinds of tracepoints. */ -- cgit v1.1