public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR 8841 for nios2-linux
@ 2017-10-16 11:50 Yao Qi
  2017-10-19 17:37 ` Sandra Loosemore
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2017-10-16 11:50 UTC (permalink / raw)
  To: gdb-patches; +Cc: sandra

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR 8841 for nios2-linux
  2017-10-16 11:50 [PATCH] Fix PR 8841 for nios2-linux Yao Qi
@ 2017-10-19 17:37 ` Sandra Loosemore
  0 siblings, 0 replies; 2+ messages in thread
From: Sandra Loosemore @ 2017-10-19 17:37 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

On 10/16/2017 05:50 AM, Yao Qi wrote:
> 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.

Thanks for looking at this!  :-)  The patch does seem to have the 
intended behavior for "finish", but there are multiple new FAILs in the 
test case sigaltstack.exp, which hasn't been adjusted to know that it's 
valid for "finish" to skip frames.  Plus that test has KFAILs for the 
existing behavior of being unable to set the breakpoint at an unwritable 
address that ought to be removed, too.

It also looks like this fix doesn't work for "step" out of a signal 
handler -- this shows up in sigstep.exp.  And there are new FAILs in 
that testcase where "finish" is doing unexpected things now too.

-Sandra

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-19 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 11:50 [PATCH] Fix PR 8841 for nios2-linux Yao Qi
2017-10-19 17:37 ` Sandra Loosemore

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).