Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGILL
@ 2011-06-09  9:28 Yao Qi
  2011-06-09 10:08 ` Andreas Schwab
  2011-06-09 11:19 ` Mark Kettenis
  0 siblings, 2 replies; 14+ messages in thread
From: Yao Qi @ 2011-06-09  9:28 UTC (permalink / raw)
  To: gdb-patches

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

In current gdb.base/savedregs.exp, signal handler is installed for
signal SIGSEGV, and SIGSEGV is trigger by `*(char *)0 = 0;'.  However,
on non-mmu uclinux system, writing to an address 0x0 doesn't trigger
SIGSEGV.

In my patch, SIGILL is chosen to replace SIGSEGV.  One assumption here
is that 0xffff is an invalid instruction on all ports.

FAILs go away on my non-mmu uclinux system, and no regression on
i686-pc-linux-gnu/x86_64-unknown-linux-gnu/armv7l-unknown-linux-gnueabi.
 OK to apply?

-- 
Yao (齐尧)

[-- Attachment #2: savedregs_sigsegv_to_sigill.patch --]
[-- Type: text/x-patch, Size: 1283 bytes --]

2011-06-09  Yao Qi  <yao@codesourcery.com>

	gdb/testsuite/
	* gdb.base/savedregs.c (catcher): Add an invalid instruction
	to trigger SIGILL.
	(main): Install catcher for signal SIGILL.
	* gdb.base/savedregs.exp (process_saved_regs): Handle SIGILL.

diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c
index 9c4ce87..9af2c6c 100644
--- a/gdb/testsuite/gdb.base/savedregs.c
+++ b/gdb/testsuite/gdb.base/savedregs.c
@@ -45,11 +45,12 @@ catcher (int sig)
 static void
 thrower (void)
 {
-  *(char *)0 = 0;
+  /* Assume 0xffff is an invalid instruction on all ports.  */
+  asm (".word 0xffff");
 }
 
 main ()
 {
-  signal (SIGSEGV, catcher);
+  signal (SIGILL, catcher);
   thrower ();
 }
diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp
index 6434512..5d9634e 100644
--- a/gdb/testsuite/gdb.base/savedregs.exp
+++ b/gdb/testsuite/gdb.base/savedregs.exp
@@ -142,7 +142,7 @@ process_saved_regs thrower { main } { }
 
 # Continue to the signal catcher, check main's saved-reg info, capture
 # catcher's saved-reg info.
-gdb_test "handle SIGSEGV pass print nostop"
+gdb_test "handle SIGILL pass print nostop"
 gdb_test "advance catcher" "catcher .* at .*"
 process_saved_regs catcher { sigtramp thrower } { main }
 

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

end of thread, other threads:[~2011-06-20 15:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09  9:28 [patch, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGILL Yao Qi
2011-06-09 10:08 ` Andreas Schwab
2011-06-09 10:53   ` Yao Qi
2011-06-09 11:19 ` Mark Kettenis
2011-06-09 11:41   ` Pedro Alves
2011-06-09 13:25     ` Yao Qi
2011-06-09 13:10   ` Yao Qi
2011-06-09 14:25     ` Pedro Alves
2011-06-20  4:13     ` [patch V2, testsuite] gdb.base/savedregs.exp: SIGSEGV -> SIGALRM Yao Qi
2011-06-20  7:03       ` Mark Kettenis
2011-06-20  8:26         ` Yao Qi
2011-06-20 11:12           ` Mark Kettenis
2011-06-20 15:07             ` Yao Qi
2011-06-20 15:14               ` Paul Koning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox