Blob Blame History Raw
2005-07-25  Jeff Johnstno  <jjohnstn@redhat.com>

	* libunwind-frame.c (libunwind_frame_prev_register): Check valuep
	is not NULL before copying cursor address into it.
	
testsuite:
2005-07-25  Jeff Johnstno  <jjohnstn@redhat.com>

	* gdb.arch/ia64-sigtramp.exp: New test.
	* gdb.arch/ia64-sigtramp.c: Ditto.

--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c.fix	2005-07-25 16:42:46.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.c	2005-07-25 16:42:08.000000000 -0400
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <signal.h>
+
+int *l;
+
+void x (int sig)
+{
+  printf ("in signal handler for signal %d\n", sig);
+}
+
+int main()
+{
+  int k;
+
+  signal (SIGSEGV, &x);
+
+  k = *l;
+
+  printf ("k is %d\n", k);
+ 
+  return 0;
+}
+
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix	2005-07-25 16:42:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp	2005-07-25 16:42:01.000000000 -0400
@@ -0,0 +1,66 @@
+#   Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+    return
+}
+
+set testfile "ia64-sigtramp"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    fail "Can't run to main"
+    return 0
+}
+
+gdb_test "handle SIGSEGV" "SIGSEGV.*Yes.*Yes.*Yes.*Segmentation fault"
+gdb_test "next" "" "first next"
+gdb_test "next" "Program received signal SIGSEGV.*" "getting SIGSEGV"
+gdb_breakpoint "x"
+gdb_test "continue" "Breakpoint.*x.*" "continue to x"
+
+gdb_test "f 1" ".*signal handler called.*" "frame 1"
+gdb_test "info frame" "Stack level 1.*p63 at .*" "info sigtramp frame"
+ 
--- gdb-6.3/gdb/libunwind-frame.c.fix	2005-07-25 16:41:30.000000000 -0400
+++ gdb-6.3/gdb/libunwind-frame.c	2005-07-25 16:46:23.000000000 -0400
@@ -303,8 +303,9 @@ libunwind_frame_prev_register (struct fr
      modification to support unwinding through a sigaltstack.  */
   if (uw_regnum == INT_MAX)
     {
-      store_unsigned_integer (valuep, sizeof (CORE_ADDR), 
-			      (CORE_ADDR)&cache->cursor);
+      if (valuep)
+        store_unsigned_integer (valuep, sizeof (CORE_ADDR), 
+			        (CORE_ADDR)&cache->cursor);
       return;
     }