fbb51ac
2005-11-15  Jeff Johnston  <jjohnstn@redhat.com>
fbb51ac
9231e41
	* linux-thread-db.c (thread_db_wait): Don't bother continuing if
fbb51ac
	the wait result indicates the program terminated with a signal.
fbb51ac
	* linux-nat.c (linux_nat_wait): For SIGILL and SIGTRAP, don't
fbb51ac
	throw away the event if the user has specified nostop noprint.
fbb51ac
fbb51ac
gdb/testsuite:
fbb51ac
fbb51ac
2005-11-15  Jeff Johnston  <jjohnstn@redhat.com>
fbb51ac
fbb51ac
	* gdb.arch/ia64-sigill.c: New test.
fbb51ac
	* gdb.arch/ia64-sigill.exp: Ditto.
fbb51ac
407ebe9
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.exp
9231e41
===================================================================
407ebe9
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
407ebe9
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.exp	2008-12-02 21:10:57.000000000 +0100
fbb51ac
@@ -0,0 +1,59 @@
fbb51ac
+#   Copyright 2005 Free Software Foundation, Inc.
fbb51ac
+
fbb51ac
+# This program is free software; you can redistribute it and/or modify
fbb51ac
+# it under the terms of the GNU General Public License as published by
fbb51ac
+# the Free Software Foundation; either version 2 of the License, or
fbb51ac
+# (at your option) any later version.
fbb51ac
+# 
fbb51ac
+# This program is distributed in the hope that it will be useful,
fbb51ac
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
fbb51ac
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
fbb51ac
+# GNU General Public License for more details.
fbb51ac
+# 
fbb51ac
+# You should have received a copy of the GNU General Public License
fbb51ac
+# along with this program; if not, write to the Free Software
fbb51ac
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
fbb51ac
+
fbb51ac
+# Please email any bugs, comments, and/or additions to this file to:
fbb51ac
+# bug-gdb@prep.ai.mit.edu
fbb51ac
+
fbb51ac
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
fbb51ac
+
fbb51ac
+if $tracelevel then {
fbb51ac
+    strace $tracelevel
fbb51ac
+}
fbb51ac
+
fbb51ac
+#
fbb51ac
+# test running programs
fbb51ac
+#
fbb51ac
+set prms_id 0
fbb51ac
+set bug_id 0
fbb51ac
+
fbb51ac
+if ![istarget "ia64-*-*"] then {
fbb51ac
+    return
fbb51ac
+}
fbb51ac
+
fbb51ac
+set testfile "ia64-sigill"
fbb51ac
+set srcfile ${testfile}.c
fbb51ac
+set binfile ${objdir}/${subdir}/${testfile}
fbb51ac
+
fbb51ac
+# Deliberately compile with pthreads, even though test is single-threaded.
fbb51ac
+# We want to force gdb thread code to be exercised.
fbb51ac
+if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
fbb51ac
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
fbb51ac
+}
fbb51ac
+
fbb51ac
+if [get_compiler_info ${binfile}] {
fbb51ac
+    return -1
fbb51ac
+}
fbb51ac
+
fbb51ac
+gdb_exit
fbb51ac
+gdb_start
fbb51ac
+gdb_reinitialize_dir $srcdir/$subdir
fbb51ac
+gdb_load ${binfile}
fbb51ac
+
fbb51ac
+# We set up SIGILL nostop, noprint, pass and then run the program.
fbb51ac
+# We expect to just see a normal run.
fbb51ac
+gdb_test "handle SIGILL nostop noprint" "SIGILL.*No.*No.*Yes.*" "handle sigill"
fbb51ac
+gdb_test "run" "Starting program.*ia64-sigill.*\[New thread.*\].*hello world.*Program exited normally." "run to exit"
fbb51ac
+ 
407ebe9
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.c
9231e41
===================================================================
407ebe9
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
407ebe9
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.c	2008-12-02 21:10:57.000000000 +0100
fbb51ac
@@ -0,0 +1,8 @@
fbb51ac
+#include <stdio.h>
fbb51ac
+
fbb51ac
+int main()
fbb51ac
+{
fbb51ac
+  printf ("hello world\n");
fbb51ac
+  return 0;
fbb51ac
+}
fbb51ac
+
407ebe9
Index: gdb-6.8.50.20081128/gdb/linux-nat.c
9231e41
===================================================================
407ebe9
--- gdb-6.8.50.20081128.orig/gdb/linux-nat.c	2008-12-02 19:04:38.000000000 +0100
407ebe9
+++ gdb-6.8.50.20081128/gdb/linux-nat.c	2008-12-02 21:11:11.000000000 +0100
407ebe9
@@ -2974,7 +2974,8 @@ retry:
fbb51ac
      threads can be a bit time-consuming so if we want decent
fbb51ac
      performance with heavily multi-threaded programs, especially when
fbb51ac
      they're using a high frequency timer, we'd better avoid it if we
fbb51ac
-     can.  */
fbb51ac
+     can.  For possible trap signals like SIGTRAP and SIGILL, don't
fbb51ac
+     avoid reporting.  */
fbb51ac
 
fbb51ac
   if (WIFSTOPPED (status))
fbb51ac
     {
407ebe9
@@ -2992,7 +2993,9 @@ retry:
407ebe9
 	  && inf->stop_soon == NO_STOP_QUIETLY
9231e41
 	  && signal_stop_state (signo) == 0
fbb51ac
 	  && signal_print_state (signo) == 0
fbb51ac
-	  && signal_pass_state (signo) == 1)
fbb51ac
+	  && signal_pass_state (signo) == 1
fbb51ac
+	  && signo != TARGET_SIGNAL_ILL
fbb51ac
+	  && signo != TARGET_SIGNAL_TRAP)
fbb51ac
 	{
fbb51ac
 	  /* FIMXE: kettenis/2001-06-06: Should we resume all threads
fbb51ac
 	     here?  It is not clear we should.  GDB may not expect