Make "maint info breakpoints" show "catch catch/throw/rethrow" locations
authorPedro Alves <palves@redhat.com>
Tue, 9 Jul 2019 18:26:16 +0000 (19:26 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 9 Jul 2019 19:00:07 +0000 (20:00 +0100)
commita38118e5d165324b4f9509fd82cf1f1c6421bfc5
treed35099288efed6eb392144307dd0bbc76867d26e
parentcb1e4e32c2d9588e1d77ea49bafb5dcdc1cff764
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 "<standard signals>"

 (gdb) maint info breakpoints
 Num     Type           Disp Enb Address            What
 3       catchpoint     keep y                      signal "<standard signals>"  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  <palves@redhat.com>

* 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/ChangeLog
gdb/break-catch-throw.c
gdb/breakpoint.c
gdb/breakpoint.h