This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix crash with libunwind support


Apparently libunwind support on ia64 has never been tested, a simple
"info frame" will crash it.

I'm also getting wildly different frame information with and without
libunwind support, I have no idea why.

Andreas.

2004-04-13  Andreas Schwab  <schwab@suse.de>

	* ia64-tdep.c (ia64_libunwind_frame_prev_register): Handle null
	value buffer.
	* libunwind-frame.c (libunwind_frame_prev_register): Likewise.

Index: gdb/ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.117
diff -u -p -a -r1.117 ia64-tdep.c
--- gdb/ia64-tdep.c	24 Feb 2004 22:35:01 -0000	1.117
+++ gdb/ia64-tdep.c	12 Apr 2004 22:29:17 -0000
@@ -2583,6 +2583,10 @@ ia64_libunwind_frame_prev_register (stru
   libunwind_frame_prev_register (next_frame, this_cache, reg,
 				 optimizedp, lvalp, addrp, realnump, valuep);
 
+  /* No more to do if the value is not supposed to be supplied.  */
+  if (!valuep)
+    return;
+
   if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
     {
       ULONGEST prN_val;
Index: gdb/libunwind-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/libunwind-frame.c,v
retrieving revision 1.2
diff -u -p -a -r1.2 libunwind-frame.c
--- gdb/libunwind-frame.c	13 Dec 2003 03:51:56 -0000	1.2
+++ gdb/libunwind-frame.c	12 Apr 2004 22:29:17 -0000
@@ -1,6 +1,6 @@
 /* Frame unwinder for frames using the libunwind library.
 
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright 2003, 2004 Free Software Foundation, Inc.
 
    Written by Jeff Johnston, contributed by Red Hat Inc.
 
@@ -259,7 +259,8 @@ libunwind_frame_prev_register (struct fr
   *lvalp = not_lval;
   *realnump = -1;
 
-  memset (valuep, 0, register_size (current_gdbarch, regnum));
+  if (valuep)
+    memset (valuep, 0, register_size (current_gdbarch, regnum));
 
   if (uw_regnum < 0)
     return;
@@ -281,7 +282,8 @@ libunwind_frame_prev_register (struct fr
   if (ret < 0)
     return;
 
-  memcpy (valuep, ptr, register_size (current_gdbarch, regnum));
+  if (valuep)
+    memcpy (valuep, ptr, register_size (current_gdbarch, regnum));
 
   if (unw_get_saveloc_p (&cache->cursor, uw_regnum, &sl) < 0)
     return;

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]