This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PR 8841 for nios2-linux
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: sandra at codesourcery dot com
- Date: Mon, 16 Oct 2017 12:50:26 +0100
- Subject: [PATCH] Fix PR 8841 for nios2-linux
- Authentication-results: sourceware.org; auth=none
This patch is to use gdbarch method code_of_frame_writable, to skip
signal trampoline frame for breakpoint setting on nios2-linux. The patch
was written last year, but forgot to upstream it.
I don't have the env to test this patch, so Sandra could you try this
patch?
gdb:
2017-10-16 Yao Qi <yao.qi@linaro.org>
PR gdb/8841
* nios2-linux-tdep.c (nios2_linux_code_of_frame_writable): New
function.
(nios2_linux_init_abi): Install gdbarch code_of_frame_writable.
---
gdb/nios2-linux-tdep.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index 8cada54..788d711 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -185,6 +185,22 @@ static struct tramp_frame nios2_r2_linux_rt_sigreturn_tramp_frame =
nios2_linux_rt_sigreturn_init
};
+/* Implement the code_of_frame_writable gdbarch method. */
+
+static int
+nios2_linux_code_of_frame_writable (struct gdbarch *gdbarch,
+ struct frame_info *frame)
+{
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
+ {
+ /* The kernel creates a signal trampoline at address 0x1044
+ that GDB cannot write to to set a software breakpoint. */
+ return 0;
+ }
+ else
+ return 1;
+}
+
/* When FRAME is at a syscall instruction, return the PC of the next
instruction to be executed. */
@@ -234,6 +250,9 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->syscall_next_pc = nios2_linux_syscall_next_pc;
+ set_gdbarch_code_of_frame_writable (gdbarch,
+ nios2_linux_code_of_frame_writable);
+
/* Index of target address word in glibc jmp_buf. */
tdep->jb_pc = 10;
}
--
1.9.1