From 77bdfeb2e6041b1d228c3ba84233650993d435de Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 21 Jul 2020 17:28:16 -0700 Subject: [PATCH] Migrate the x86 MPX handle_segmentation_fault hook to report_signal_info. gdb/ChangeLog: * amd64-linux-tdep.c (amd64_linux_init_abi_common): Use i386_linux_report_signal_info instead of i386_linux_handle_segmentation_fault. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Rename to i386_linux_report_signal_info and add siggnal argument. (i386_linux_init_abi): Use i386_linux_report_signal_info instead of i386_linux_handle_segmentation_fault. * i386-linux-tdep.h (i386_linux_handle_segmentation_fault): Rename to i386_linux_report_signal_info and add siggnal argument. --- gdb/ChangeLog | 12 ++++++++++++ gdb/amd64-linux-tdep.c | 3 +-- gdb/i386-linux-tdep.c | 11 +++++------ gdb/i386-linux-tdep.h | 5 +++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1bd80b6762e..edb2cb72685 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2020-07-21 John Baldwin + + * amd64-linux-tdep.c (amd64_linux_init_abi_common): Use + i386_linux_report_signal_info instead of + i386_linux_handle_segmentation_fault. + * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Rename + to i386_linux_report_signal_info and add siggnal argument. + (i386_linux_init_abi): Use i386_linux_report_signal_info instead + of i386_linux_handle_segmentation_fault. + * i386-linux-tdep.h (i386_linux_handle_segmentation_fault): Rename + to i386_linux_report_signal_info and add siggnal argument. + 2020-07-21 John Baldwin * corelow.c (core_target_open): Invoke gdbarch report_signal_info diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 44ecb4e0b33..42000159bd8 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1846,8 +1846,7 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal); set_gdbarch_get_siginfo_type (gdbarch, x86_linux_get_siginfo_type); - set_gdbarch_handle_segmentation_fault (gdbarch, - i386_linux_handle_segmentation_fault); + set_gdbarch_report_signal_info (gdbarch, i386_linux_report_signal_info); } static void diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index c576b319566..7270931f016 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -388,19 +388,19 @@ i386_canonicalize_syscall (int syscall) #define SIG_CODE_BONDARY_FAULT 3 -/* i386 GNU/Linux implementation of the handle_segmentation_fault +/* i386 GNU/Linux implementation of the report_signal_info gdbarch hook. Displays information related to MPX bound violations. */ void -i386_linux_handle_segmentation_fault (struct gdbarch *gdbarch, - struct ui_out *uiout) +i386_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, + enum gdb_signal siggnal) { /* -Wmaybe-uninitialized */ CORE_ADDR lower_bound = 0, upper_bound = 0, access = 0; int is_upper; long sig_code = 0; - if (!i386_mpx_enabled ()) + if (!i386_mpx_enabled () || siggnal != GDB_SIGNAL_SEGV) return; try @@ -1073,8 +1073,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) i386_linux_get_syscall_number); set_gdbarch_get_siginfo_type (gdbarch, x86_linux_get_siginfo_type); - set_gdbarch_handle_segmentation_fault (gdbarch, - i386_linux_handle_segmentation_fault); + set_gdbarch_report_signal_info (gdbarch, i386_linux_report_signal_info); } void _initialize_i386_linux_tdep (); diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index b54352694a3..c3bfdcd830c 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -39,8 +39,9 @@ extern uint64_t i386_linux_core_read_xcr0 (bfd *abfd); /* Handle and display information related to the MPX bound violation to the user. */ -extern void i386_linux_handle_segmentation_fault (struct gdbarch *gdbarch, - struct ui_out *uiout); +extern void i386_linux_report_signal_info (struct gdbarch *gdbarch, + struct ui_out *uiout, + enum gdb_signal siggnal); /* Return the target description according to XCR0. */ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); -- 2.30.2