Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix crash with libunwind support
@ 2004-04-12 22:54 Andreas Schwab
  2004-04-13 18:37 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2004-04-12 22:54 UTC (permalink / raw)
  To: gdb-patches

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


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

end of thread, other threads:[~2004-04-13 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-12 22:54 [PATCH] Fix crash with libunwind support Andreas Schwab
2004-04-13 18:37 ` Kevin Buettner

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