public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] unbreak nios2-*-linux* testing
@ 2015-06-30 14:59 Sandra Loosemore
  2015-07-06 16:34 ` Sandra Loosemore
  0 siblings, 1 reply; 3+ messages in thread
From: Sandra Loosemore @ 2015-06-30 14:59 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

As previously noted, on Nios II Linux targets, the kernel now puts 
signal handler handler trampolines on a read-only page of memory and GDB 
cannot set single-step breakpoints there.  My last attempt at working 
around this

https://sourceware.org/ml/gdb-patches/2015-04/msg01092.html

was rejected in favor of some not-yet-implemented target-independent 
solution:

https://sourceware.org/ml/gdb-patches/2015-05/msg00183.html

Given that the discussion pointed to by that thread is 11 years old, I 
think it's safe to say that fixing this is not a priority.  :-(

Meanwhile, the GDB testsuite remains broken on this target.  Tests are 
not just failing, but getting stuck in infinite loops trying 
unsuccessfully to step out of a signal handler without recognizing that 
they are stuck.  This is blocking regression testing of other patches in 
my queue.

This patch adds kfails for these issues similar to what other targets 
with this problem already do.  There are no code changes.

OK to commit, so I can get on with other work?

-Sandra


[-- Attachment #2: gdb-breakpoint.log --]
[-- Type: text/x-log, Size: 180 bytes --]

2015-05-08  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.c (nios2_breakpoint_from_pc): Revert to using
	"trap 31" as the breakpoint instruction on all targets.

[-- Attachment #3: gdb-breakpoint.patch --]
[-- Type: text/x-patch, Size: 1722 bytes --]

diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 08f2034..988b9fc 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1189,7 +1189,15 @@ nios2_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
   return nios2_analyze_prologue (gdbarch, start_pc, start_pc, &cache, NULL);
 }
 
-/* Implement the breakpoint_from_pc gdbarch hook.  */
+/* Implement the breakpoint_from_pc gdbarch hook.
+
+   The Nios II ABI for Linux says: "Userspace programs should not use
+   the break instruction and userspace debuggers should not insert
+   one." and "Userspace breakpoints are accomplished using the trap
+   instruction with immediate operand 31 (all ones)."
+
+   So, we use "trap 31" consistently as the breakpoint on bare-metal
+   as well as Linux targets.  */
 
 static const gdb_byte*
 nios2_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
@@ -1198,11 +1206,11 @@ nios2_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr,
   enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
   unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
 
-  /* R1 break encoding:
-     ((0x1e << 17) | (0x34 << 11) | (0x1f << 6) | (0x3a << 0))
-     0x003da7fa */
-  static const gdb_byte r1_breakpoint_le[] = {0xfa, 0xa7, 0x3d, 0x0};
-  static const gdb_byte r1_breakpoint_be[] = {0x0, 0x3d, 0xa7, 0xfa};
+  /* R1 trap encoding:
+     ((0x1d << 17) | (0x2d << 11) | (0x1f << 6) | (0x3a << 0))
+     0x003b6ffa */
+  static const gdb_byte r1_breakpoint_le[] = {0xfa, 0x6f, 0x3b, 0x0};
+  static const gdb_byte r1_breakpoint_be[] = {0x0, 0x3b, 0x6f, 0xfa};
   *bp_size = NIOS2_OPCODE_SIZE;
   if (byte_order_for_code == BFD_ENDIAN_BIG)
     return r1_breakpoint_be;

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

* Re: [patch] unbreak nios2-*-linux* testing
  2015-06-30 14:59 [patch] unbreak nios2-*-linux* testing Sandra Loosemore
@ 2015-07-06 16:34 ` Sandra Loosemore
  2015-07-14  7:42   ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Sandra Loosemore @ 2015-07-06 16:34 UTC (permalink / raw)
  To: Yao Qi, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

On 06/30/2015 08:57 AM, Sandra Loosemore wrote:
> As previously noted, on Nios II Linux targets, the kernel now puts
> signal handler handler trampolines on a read-only page of memory and GDB
> cannot set single-step breakpoints there.  My last attempt at working
> around this
>
> https://sourceware.org/ml/gdb-patches/2015-04/msg01092.html
>
> was rejected in favor of some not-yet-implemented target-independent
> solution:
>
> https://sourceware.org/ml/gdb-patches/2015-05/msg00183.html
>
> Given that the discussion pointed to by that thread is 11 years old, I
> think it's safe to say that fixing this is not a priority.  :-(
>
> Meanwhile, the GDB testsuite remains broken on this target.  Tests are
> not just failing, but getting stuck in infinite loops trying
> unsuccessfully to step out of a signal handler without recognizing that
> they are stuck.  This is blocking regression testing of other patches in
> my queue.
>
> This patch adds kfails for these issues similar to what other targets
> with this problem already do.  There are no code changes.
>
> OK to commit, so I can get on with other work?
>
> -Sandra
>

I realized I attached the wrong patch to my previous mail.  Here's the 
right one.  Is this one OK?

-Sandra


[-- Attachment #2: gdb-testsuite.log --]
[-- Type: text/x-log, Size: 284 bytes --]

2015-06-29  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.base/sigaltstack.exp (finish_test): Add kfail for
	nios2-*-linux*.
	* gdb.base/sigbpt.exp (stepi_out): Likewise.
	* gdb.base/siginfo.exp: Likewise.
	* gdb.base/sigstep.exp (advance, advancei): Likewise.


[-- Attachment #3: gdb-testsuite.patch --]
[-- Type: text/x-patch, Size: 2723 bytes --]

diff --git a/gdb/testsuite/gdb.base/sigaltstack.exp b/gdb/testsuite/gdb.base/sigaltstack.exp
index b65ea48..59a6c17 100644
--- a/gdb/testsuite/gdb.base/sigaltstack.exp
+++ b/gdb/testsuite/gdb.base/sigaltstack.exp
@@ -76,6 +76,7 @@ proc finish_test { pattern msg } {
 	    # don't gracefully fall back to single-stepping.
 	    setup_kfail gdb/8841 "i?86-*-linux*"
 	    setup_kfail gdb/8841 "*-*-openbsd*"
+	    setup_kfail gdb/8841 "nios2-*-linux*"
 	    fail "$msg (could not set breakpoint)"
 	}
 	-re "$pattern.*${gdb_prompt} $" {
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index ac1378f..a53a71c 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -159,6 +159,10 @@ proc stepi_out { name args } {
 	    setup_kfail gdb/8841 "sparc*-*-openbsd*"
 	    fail "$test (could not insert single-step breakpoint)"
 	}
+	-re "Cannot insert breakpoint.*Cannot access memory.*$gdb_prompt $" {
+	    setup_kfail gdb/8841 "nios2*-*-linux*"
+	    fail "$test (could not insert single-step breakpoint)"
+	}
 	-re "keeper.*$gdb_prompt $" {
 	    send_gdb "stepi\n"
 	    exp_continue
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index 1ae87dd..45365a5 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -64,6 +64,10 @@ gdb_test_multiple "step" "${test}" {
 	setup_kfail gdb/8841 sparc*-*-openbsd*
 	fail "$test (could not insert single-step breakpoint)"
     }
+    -re "Cannot insert breakpoint.*Cannot access memory.*$gdb_prompt $" {
+        setup_kfail gdb/8841 "nios2*-*-linux*"
+	fail "$test (could not insert single-step breakpoint)"
+    }
     -re "done = 1;.*${gdb_prompt} $" {
 	send_gdb "$i\n"
 	exp_continue
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 3c9454c..413f6de 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -109,6 +109,10 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
 		setup_kfail gdb/8841 "sparc*-*-openbsd*"
 		fail "$test (could not insert single-step breakpoint)"
 	    }
+	    -re "Cannot insert breakpoint.*Cannot access memory.*$gdb_prompt $" {
+		setup_kfail gdb/8841 "nios2*-*-linux*"
+		fail "$test (could not insert single-step breakpoint)"
+	    }
 	    -re "done = 1;.*${gdb_prompt} $" {
 		send_gdb "$exit_cmd\n"
 		exp_continue -continue_timer
@@ -203,6 +207,7 @@ proc advancei { cmd } {
 		# don't gracefully fall back to single-stepping.
 		setup_kfail gdb/8841 "i?86-*-linux*"
 		setup_kfail gdb/8841 "*-*-openbsd*"
+		setup_kfail gdb/8841 "nios2-*-linux*"
 		fail "$test (could not set breakpoint)"
 		return
 	    }

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

* Re: [patch] unbreak nios2-*-linux* testing
  2015-07-06 16:34 ` Sandra Loosemore
@ 2015-07-14  7:42   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2015-07-14  7:42 UTC (permalink / raw)
  To: Sandra Loosemore, gdb-patches

On 06/07/15 17:32, Sandra Loosemore wrote:
> 2015-06-29  Sandra Loosemore<sandra@codesourcery.com>
>
> 	gdb/testsuite/
> 	* gdb.base/sigaltstack.exp (finish_test): Add kfail for
> 	nios2-*-linux*.
> 	* gdb.base/sigbpt.exp (stepi_out): Likewise.
> 	* gdb.base/siginfo.exp: Likewise.
> 	* gdb.base/sigstep.exp (advance, advancei): Likewise.

Patch looks good to me.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2015-07-14  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-30 14:59 [patch] unbreak nios2-*-linux* testing Sandra Loosemore
2015-07-06 16:34 ` Sandra Loosemore
2015-07-14  7:42   ` Yao Qi

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