diff options
author | John Baldwin <jhb@FreeBSD.org> | 2020-07-21 17:28:16 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2020-07-21 17:28:16 -0700 |
commit | 272bb05cc59ccfbb15f9e496d4d2ec243e08473c (patch) | |
tree | 9ee0e68b116b3ddc274dc9c2f01ab593d4df703b /gdb/gdbarch.c | |
parent | 98f5f7740a4bb7c09e4e3f934f8fd8be47bfbbc8 (diff) | |
download | binutils-272bb05cc59ccfbb15f9e496d4d2ec243e08473c.zip binutils-272bb05cc59ccfbb15f9e496d4d2ec243e08473c.tar.gz binutils-272bb05cc59ccfbb15f9e496d4d2ec243e08473c.tar.bz2 |
Add a new gdbarch hook to report additional signal information.
This is a more general version of the existing handle_segmentation_fault
hook that is able to report information for an arbitrary signal, not
just SIGSEGV.
gdb/ChangeLog:
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (report_signal_info): New method.
* infrun.c (print_signal_received_reason): Invoke gdbarch
report_signal_info hook if present.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 21ee840..d393e7a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -192,6 +192,7 @@ struct gdbarch gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect; gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack; gdbarch_handle_segmentation_fault_ftype *handle_segmentation_fault; + gdbarch_report_signal_info_ftype *report_signal_info; int sp_regnum; int pc_regnum; int ps_regnum; @@ -556,6 +557,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of ax_pseudo_register_collect, has predicate. */ /* Skip verify of ax_pseudo_register_push_stack, has predicate. */ /* Skip verify of handle_segmentation_fault, has predicate. */ + /* Skip verify of report_signal_info, has predicate. */ /* Skip verify of sp_regnum, invalid_p == 0 */ /* Skip verify of pc_regnum, invalid_p == 0 */ /* Skip verify of ps_regnum, invalid_p == 0 */ @@ -1321,6 +1323,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: remote_register_number = <%s>\n", host_address_to_string (gdbarch->remote_register_number)); fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_report_signal_info_p() = %d\n", + gdbarch_report_signal_info_p (gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: report_signal_info = <%s>\n", + host_address_to_string (gdbarch->report_signal_info)); + fprintf_unfiltered (file, "gdbarch_dump: return_in_first_hidden_param_p = <%s>\n", host_address_to_string (gdbarch->return_in_first_hidden_param_p)); fprintf_unfiltered (file, @@ -2114,6 +2122,30 @@ set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, } int +gdbarch_report_signal_info_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->report_signal_info != NULL; +} + +void +gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->report_signal_info != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_report_signal_info called\n"); + gdbarch->report_signal_info (gdbarch, uiout, siggnal); +} + +void +set_gdbarch_report_signal_info (struct gdbarch *gdbarch, + gdbarch_report_signal_info_ftype report_signal_info) +{ + gdbarch->report_signal_info = report_signal_info; +} + +int gdbarch_sp_regnum (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); |