* [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault
@ 2020-07-17 22:03 John Baldwin
2020-07-17 22:03 ` [PATCH 1/5] Add a new gdbarch hook to report additional signal information John Baldwin
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
The gdbarch_handle_segmentation_fault hook can be used to report
architecture-specific information about SIGSEGV signals. However,
architectures may want to provide information about other signals. In
addition, on a project I'm working on developers requested signal
specific information when opening a core file.
This series adds a new gdbarch_report_signal_info hook that is invoked
when GDB wants to report information for any received signal as well
as when opening a core file for a process terminated by a signal. The
name "report" seems more accurate to me than "handle" as the existing
"handle" hooks are not able to adjust program state to permit
continuing after a SIGSEGV, they simply report additional details
about the signal.
I did migrate the existing handle_segmentation_fault hooks, but I have
not added any new hooks that handle signals other than SIGPROT. I do
have them in a downstream branch for a research architecture (CHERI)
that is not suitable for upstreaming. It reports additional
information for both SIGSEGV signals and a new SIGPROT signal used to
report MPX-like failures (e.g. buffer overflows).
John Baldwin (5):
Add a new gdbarch hook to report additional signal information.
Report architecture-specific signal information for core files.
Migrate the x86 MPX handle_segmentation_fault hook to
report_signal_info.
Migrate the sparc64 ADI handle_segmentation_fault hook to
report_signal_info.
Retire the now-unused gdbarch handle_segmentation_fault hook.
gdb/ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++
gdb/amd64-linux-tdep.c | 3 +--
gdb/corelow.c | 5 ++++-
gdb/gdbarch.c | 34 ++++++++++++++++----------------
gdb/gdbarch.h | 13 ++++++-------
gdb/gdbarch.sh | 7 +++----
gdb/i386-linux-tdep.c | 11 +++++------
gdb/i386-linux-tdep.h | 5 +++--
gdb/infrun.c | 20 ++++---------------
gdb/sparc64-linux-tdep.c | 12 ++++++------
10 files changed, 91 insertions(+), 61 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] Add a new gdbarch hook to report additional signal information.
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
@ 2020-07-17 22:03 ` John Baldwin
2020-07-17 22:03 ` [PATCH 2/5] Report architecture-specific signal information for core files John Baldwin
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
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.
---
gdb/ChangeLog | 8 ++++++++
gdb/gdbarch.c | 32 ++++++++++++++++++++++++++++++++
gdb/gdbarch.h | 10 ++++++++++
gdb/gdbarch.sh | 5 +++++
gdb/infrun.c | 5 +++++
5 files changed, 60 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1b5bc8b458..145a5dd2c2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-07-17 John Baldwin <jhb@FreeBSD.org>
+
+ * 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.
+
2020-07-17 Tom Tromey <tromey@adacore.com>
* linux-nat.c (linux_nat_target::supports_non_stop)
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 21ee840e88..d393e7a734 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 */
@@ -1320,6 +1322,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (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));
@@ -2113,6 +2121,30 @@ set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch,
gdbarch->handle_segmentation_fault = handle_segmentation_fault;
}
+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)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 0940156aeb..9414407b04 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -332,6 +332,16 @@ typedef void (gdbarch_handle_segmentation_fault_ftype) (struct gdbarch *gdbarch,
extern void gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, struct ui_out *uiout);
extern void set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, gdbarch_handle_segmentation_fault_ftype *handle_segmentation_fault);
+/* Some architectures can display additional information for specific
+ signals.
+ UIOUT is the output stream where the handler will place information. */
+
+extern int gdbarch_report_signal_info_p (struct gdbarch *gdbarch);
+
+typedef void (gdbarch_report_signal_info_ftype) (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal);
+extern void gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal);
+extern void set_gdbarch_report_signal_info (struct gdbarch *gdbarch, gdbarch_report_signal_info_ftype *report_signal_info);
+
/* GDB's standard (or well known) register numbers. These can map onto
a real register or a pseudo (computed) register or not be defined at
all (-1).
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 41e7b8d5cc..1601879532 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -420,6 +420,11 @@ M;int;ax_pseudo_register_push_stack;struct agent_expr *ax, int reg;ax, reg
# UIOUT is the output stream where the handler will place information.
M;void;handle_segmentation_fault;struct ui_out *uiout;uiout
+# Some architectures can display additional information for specific
+# signals.
+# UIOUT is the output stream where the handler will place information.
+M;void;report_signal_info;struct ui_out *uiout, enum gdb_signal siggnal;uiout, siggnal
+
# GDB's standard (or well known) register numbers. These can map onto
# a real register or a pseudo (computed) register or not be defined at
# all (-1).
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 31266109a6..e58b623954 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8299,6 +8299,11 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
annotate_signal_string ();
uiout->field_string ("signal-meaning", gdb_signal_to_string (siggnal));
+ struct regcache *regcache = get_current_regcache ();
+ struct gdbarch *gdbarch = regcache->arch ();
+ if (gdbarch_report_signal_info_p (gdbarch))
+ gdbarch_report_signal_info (gdbarch, uiout, siggnal);
+
if (siggnal == GDB_SIGNAL_SEGV)
handle_segmentation_fault (uiout);
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] Report architecture-specific signal information for core files.
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
2020-07-17 22:03 ` [PATCH 1/5] Add a new gdbarch hook to report additional signal information John Baldwin
@ 2020-07-17 22:03 ` John Baldwin
2020-07-17 22:03 ` [PATCH 3/5] Migrate the x86 MPX handle_segmentation_fault hook to report_signal_info John Baldwin
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
When opening a core file, if the process terminated due to a signal,
invoke the gdbarch report_signal_info hook to report
architecture-specific information about the signal.
gdb/ChangeLog:
* corelow.c (core_target_open): Invoke gdbarch report_signal_info
hook if present.
---
gdb/ChangeLog | 5 +++++
gdb/corelow.c | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 145a5dd2c2..a18e8d8993 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-17 John Baldwin <jhb@FreeBSD.org>
+
+ * corelow.c (core_target_open): Invoke gdbarch report_signal_info
+ hook if present.
+
2020-07-17 John Baldwin <jhb@FreeBSD.org>
* gdbarch.c: Regenerate.
diff --git a/gdb/corelow.c b/gdb/corelow.c
index b6a12c0818..3958af1e67 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -416,8 +416,11 @@ core_target_open (const char *arg, int from_tty)
siggy)
: gdb_signal_from_host (siggy));
- printf_filtered (_("Program terminated with signal %s, %s.\n"),
+ printf_filtered (_("Program terminated with signal %s, %s"),
gdb_signal_to_name (sig), gdb_signal_to_string (sig));
+ if (gdbarch_report_signal_info_p (core_gdbarch))
+ gdbarch_report_signal_info (core_gdbarch, current_uiout, sig);
+ printf_filtered (_(".\n"));
/* Set the value of the internal variable $_exitsignal,
which holds the signal uncaught by the inferior. */
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] Migrate the x86 MPX handle_segmentation_fault hook to report_signal_info.
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
2020-07-17 22:03 ` [PATCH 1/5] Add a new gdbarch hook to report additional signal information John Baldwin
2020-07-17 22:03 ` [PATCH 2/5] Report architecture-specific signal information for core files John Baldwin
@ 2020-07-17 22:03 ` John Baldwin
2020-07-17 22:03 ` [PATCH 4/5] Migrate the sparc64 ADI " John Baldwin
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
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 a18e8d8993..ae5ee27a11 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2020-07-17 John Baldwin <jhb@FreeBSD.org>
+
+ * 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-17 John Baldwin <jhb@FreeBSD.org>
* 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 44ecb4e0b3..42000159bd 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 c576b31956..7270931f01 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 b54352694a..c3bfdcd830 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.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] Migrate the sparc64 ADI handle_segmentation_fault hook to report_signal_info.
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
` (2 preceding siblings ...)
2020-07-17 22:03 ` [PATCH 3/5] Migrate the x86 MPX handle_segmentation_fault hook to report_signal_info John Baldwin
@ 2020-07-17 22:03 ` John Baldwin
2020-07-17 22:03 ` [PATCH 5/5] Retire the now-unused gdbarch handle_segmentation_fault hook John Baldwin
2020-07-21 18:40 ` [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault Tom Tromey
5 siblings, 0 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
gdb/ChangeLog:
* sparc64-linux-tdep.c (sparc64_linux_handle_segmentation_fault):
Rename to sparc64_linux_report_signal_info and add siggnal
argument.
(sparc64_linux_init_abi): Use sparc64_linux_report_signal_info
instead of sparc64_linux_handle_segmentation_fault.
---
gdb/ChangeLog | 8 ++++++++
gdb/sparc64-linux-tdep.c | 12 ++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ae5ee27a11..ca7a27180e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-07-17 John Baldwin <jhb@FreeBSD.org>
+
+ * sparc64-linux-tdep.c (sparc64_linux_handle_segmentation_fault):
+ Rename to sparc64_linux_report_signal_info and add siggnal
+ argument.
+ (sparc64_linux_init_abi): Use sparc64_linux_report_signal_info
+ instead of sparc64_linux_handle_segmentation_fault.
+
2020-07-17 John Baldwin <jhb@FreeBSD.org>
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Use
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index a7f439fbb0..9a73ca1b04 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -116,15 +116,16 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
-/* sparc64 GNU/Linux implementation of the handle_segmentation_fault
+/* sparc64 GNU/Linux implementation of the report_signal_info
gdbarch hook.
Displays information related to ADI memory corruptions. */
static void
-sparc64_linux_handle_segmentation_fault (struct gdbarch *gdbarch,
- struct ui_out *uiout)
+sparc64_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
+ enum gdb_signal siggnal)
{
- if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 64)
+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 64
+ || siggnal != GDB_SIGNAL_SEGV)
return;
CORE_ADDR addr = 0;
@@ -404,8 +405,7 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC64);
set_gdbarch_get_syscall_number (gdbarch,
sparc64_linux_get_syscall_number);
- set_gdbarch_handle_segmentation_fault (gdbarch,
- sparc64_linux_handle_segmentation_fault);
+ set_gdbarch_report_signal_info (gdbarch, sparc64_linux_report_signal_info);
}
void _initialize_sparc64_linux_tdep ();
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] Retire the now-unused gdbarch handle_segmentation_fault hook.
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
` (3 preceding siblings ...)
2020-07-17 22:03 ` [PATCH 4/5] Migrate the sparc64 ADI " John Baldwin
@ 2020-07-17 22:03 ` John Baldwin
2020-07-21 18:40 ` [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault Tom Tromey
5 siblings, 0 replies; 7+ messages in thread
From: John Baldwin @ 2020-07-17 22:03 UTC (permalink / raw)
To: gdb-patches
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (handle_segmentation_fault): Remove method.
* infrun.c (handle_segmentation_fault): Remove.
(print_signal_received_reason): Remove call to
handle_segmentation_fault.
---
gdb/ChangeLog | 9 +++++++++
gdb/gdbarch.c | 32 --------------------------------
gdb/gdbarch.h | 11 -----------
gdb/gdbarch.sh | 6 ------
gdb/infrun.c | 17 -----------------
5 files changed, 9 insertions(+), 66 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca7a27180e..c174934211 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2020-07-17 John Baldwin <jhb@FreeBSD.org>
+
+ * gdbarch.c: Regenerate.
+ * gdbarch.h: Regenerate.
+ * gdbarch.sh (handle_segmentation_fault): Remove method.
+ * infrun.c (handle_segmentation_fault): Remove.
+ (print_signal_received_reason): Remove call to
+ handle_segmentation_fault.
+
2020-07-17 John Baldwin <jhb@FreeBSD.org>
* sparc64-linux-tdep.c (sparc64_linux_handle_segmentation_fault):
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index d393e7a734..fd5b0301ab 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -191,7 +191,6 @@ struct gdbarch
int num_pseudo_regs;
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;
@@ -556,7 +555,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of num_pseudo_regs, invalid_p == 0 */
/* 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 */
@@ -1088,12 +1086,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: half_format = %s\n",
pformat (gdbarch->half_format));
- fprintf_unfiltered (file,
- "gdbarch_dump: gdbarch_handle_segmentation_fault_p() = %d\n",
- gdbarch_handle_segmentation_fault_p (gdbarch));
- fprintf_unfiltered (file,
- "gdbarch_dump: handle_segmentation_fault = <%s>\n",
- host_address_to_string (gdbarch->handle_segmentation_fault));
fprintf_unfiltered (file,
"gdbarch_dump: has_dos_based_file_system = %s\n",
plongest (gdbarch->has_dos_based_file_system));
@@ -2097,30 +2089,6 @@ set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
gdbarch->ax_pseudo_register_push_stack = ax_pseudo_register_push_stack;
}
-int
-gdbarch_handle_segmentation_fault_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- return gdbarch->handle_segmentation_fault != NULL;
-}
-
-void
-gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, struct ui_out *uiout)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->handle_segmentation_fault != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_handle_segmentation_fault called\n");
- gdbarch->handle_segmentation_fault (gdbarch, uiout);
-}
-
-void
-set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch,
- gdbarch_handle_segmentation_fault_ftype handle_segmentation_fault)
-{
- gdbarch->handle_segmentation_fault = handle_segmentation_fault;
-}
-
int
gdbarch_report_signal_info_p (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 9414407b04..6c125d10ae 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -321,17 +321,6 @@ typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbar
extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
-/* Some targets/architectures can do extra processing/display of
- segmentation faults. E.g., Intel MPX boundary faults.
- Call the architecture dependent function to handle the fault.
- UIOUT is the output stream where the handler will place information. */
-
-extern int gdbarch_handle_segmentation_fault_p (struct gdbarch *gdbarch);
-
-typedef void (gdbarch_handle_segmentation_fault_ftype) (struct gdbarch *gdbarch, struct ui_out *uiout);
-extern void gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, struct ui_out *uiout);
-extern void set_gdbarch_handle_segmentation_fault (struct gdbarch *gdbarch, gdbarch_handle_segmentation_fault_ftype *handle_segmentation_fault);
-
/* Some architectures can display additional information for specific
signals.
UIOUT is the output stream where the handler will place information. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 1601879532..5adfd29ad4 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -414,12 +414,6 @@ M;int;ax_pseudo_register_collect;struct agent_expr *ax, int reg;ax, reg
# Return -1 if something goes wrong, 0 otherwise.
M;int;ax_pseudo_register_push_stack;struct agent_expr *ax, int reg;ax, reg
-# Some targets/architectures can do extra processing/display of
-# segmentation faults. E.g., Intel MPX boundary faults.
-# Call the architecture dependent function to handle the fault.
-# UIOUT is the output stream where the handler will place information.
-M;void;handle_segmentation_fault;struct ui_out *uiout;uiout
-
# Some architectures can display additional information for specific
# signals.
# UIOUT is the output stream where the handler will place information.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e58b623954..ca850f81c4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8243,20 +8243,6 @@ print_exited_reason (struct ui_out *uiout, int exitstatus)
}
}
-/* Some targets/architectures can do extra processing/display of
- segmentation faults. E.g., Intel MPX boundary faults.
- Call the architecture dependent function to handle the fault. */
-
-static void
-handle_segmentation_fault (struct ui_out *uiout)
-{
- struct regcache *regcache = get_current_regcache ();
- struct gdbarch *gdbarch = regcache->arch ();
-
- if (gdbarch_handle_segmentation_fault_p (gdbarch))
- gdbarch_handle_segmentation_fault (gdbarch, uiout);
-}
-
void
print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
{
@@ -8304,9 +8290,6 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
if (gdbarch_report_signal_info_p (gdbarch))
gdbarch_report_signal_info (gdbarch, uiout, siggnal);
- if (siggnal == GDB_SIGNAL_SEGV)
- handle_segmentation_fault (uiout);
-
annotate_signal_string_end ();
}
uiout->text (".\n");
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
` (4 preceding siblings ...)
2020-07-17 22:03 ` [PATCH 5/5] Retire the now-unused gdbarch handle_segmentation_fault hook John Baldwin
@ 2020-07-21 18:40 ` Tom Tromey
5 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-07-21 18:40 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:
John> John Baldwin (5):
John> Add a new gdbarch hook to report additional signal information.
John> Report architecture-specific signal information for core files.
John> Migrate the x86 MPX handle_segmentation_fault hook to
John> report_signal_info.
John> Migrate the sparc64 ADI handle_segmentation_fault hook to
John> report_signal_info.
John> Retire the now-unused gdbarch handle_segmentation_fault hook.
I read through these and they all look good.
Thank you for doing this.
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-21 18:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 22:03 [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault John Baldwin
2020-07-17 22:03 ` [PATCH 1/5] Add a new gdbarch hook to report additional signal information John Baldwin
2020-07-17 22:03 ` [PATCH 2/5] Report architecture-specific signal information for core files John Baldwin
2020-07-17 22:03 ` [PATCH 3/5] Migrate the x86 MPX handle_segmentation_fault hook to report_signal_info John Baldwin
2020-07-17 22:03 ` [PATCH 4/5] Migrate the sparc64 ADI " John Baldwin
2020-07-17 22:03 ` [PATCH 5/5] Retire the now-unused gdbarch handle_segmentation_fault hook John Baldwin
2020-07-21 18:40 ` [PATCH 0/5] Genericize gdbarch_handle_segmentation_fault Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).