Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org,	binutils@sourceware.org
Subject: [PATCH 2/2] Add a signal frame unwinder for FreeBSD/mipsn32.
Date: Tue, 19 Sep 2017 20:48:00 -0000	[thread overview]
Message-ID: <20170919204814.93328-3-jhb@FreeBSD.org> (raw)
In-Reply-To: <20170919204814.93328-1-jhb@FreeBSD.org>

The N32 signal frame uses an identical layout to N64, so reuse the N64
handler.  The N32 signal trampoline does use one different instruction
relative to N64, so a separate tramp_frame is required.

gdb/ChangeLog:

	* mips-fbsd-tdep.c (MIPS_INST_ADDIU_A0_SP_N32): Define.
	(mipsn32_fbsd_sigframe): Define.
	(mips_fbsd_init_abi): Install mipsn32_fbsd_sigframe unwinder
	for FreeBSD/mipsn32.
---
 gdb/ChangeLog        |  7 +++++++
 gdb/mips-fbsd-tdep.c | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4d544f116a..261df9d477 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2017-09-19  John Baldwin  <jhb@FreeBSD.org>
 
+	* mips-fbsd-tdep.c (MIPS_INST_ADDIU_A0_SP_N32): Define.
+	(mipsn32_fbsd_sigframe): Define.
+	(mips_fbsd_init_abi): Install mipsn32_fbsd_sigframe unwinder
+	for FreeBSD/mipsn32.
+
+2017-09-19  John Baldwin  <jhb@FreeBSD.org>
+
 	* NEWS (Changes since GDB 8.0): Add starti.
 	* infcmd.c (enum run_break): New.
 	(run_command_1): Queue pending event for RUN_STOP_AT_FIRST_INSN
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 05545e37d8..b1578d0cbb 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -426,6 +426,23 @@ mips64_fbsd_sigframe_init (const struct tramp_frame *self,
   trad_frame_set_id (cache, frame_id_build (sp, func));
 }
 
+#define MIPS_INST_ADDIU_A0_SP_N32 (0x27a40000 \
+				   + N64_SIGFRAME_UCONTEXT_OFFSET)
+
+static const struct tramp_frame mipsn32_fbsd_sigframe =
+{
+  SIGTRAMP_FRAME,
+  MIPS_INSN32_SIZE,
+  {
+    { MIPS_INST_ADDIU_A0_SP_N32, -1 },	/* addiu   a0, sp, SIGF_UC */
+    { MIPS_INST_LI_V0_SIGRETURN, -1 },	/* li      v0, SYS_sigreturn */
+    { MIPS_INST_SYSCALL, -1 },		/* syscall */
+    { MIPS_INST_BREAK, -1 },		/* break */
+    { TRAMP_SENTINEL_INSN, -1 }
+  },
+  mips64_fbsd_sigframe_init
+};
+
 #define MIPS_INST_DADDIU_A0_SP_N64 (0x67a40000 \
 				    + N64_SIGFRAME_UCONTEXT_OFFSET)
 
@@ -519,6 +536,7 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 	tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe);
 	break;
       case MIPS_ABI_N32:
+	tramp_frame_prepend_unwinder (gdbarch, &mipsn32_fbsd_sigframe);
 	break;
       case MIPS_ABI_N64:
 	tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe);
-- 
2.13.3


  parent reply	other threads:[~2017-09-19 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 20:48 [PATCH 0/2] Support for FreeBSD/mips N32 John Baldwin
2017-09-19 20:48 ` [PATCH 1/2] Account for padding in FreeBSD/mipsn32 NT_PRSTATUS notes John Baldwin
2017-09-19 20:48 ` John Baldwin [this message]
2017-10-11 11:16   ` [PATCH 2/2] Add a signal frame unwinder for FreeBSD/mipsn32 Pedro Alves
2017-09-20  2:01 ` [PATCH 0/2] Support for FreeBSD/mips N32 Alan Modra
2017-09-20  4:25   ` John Baldwin
2017-09-26 21:09     ` John Baldwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919204814.93328-3-jhb@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox