Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Fix crash with libunwind support
Date: Mon, 12 Apr 2004 22:54:00 -0000	[thread overview]
Message-ID: <jen05gkdst.fsf@sykes.suse.de> (raw)

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


             reply	other threads:[~2004-04-12 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-12 22:54 Andreas Schwab [this message]
2004-04-13 18:37 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jen05gkdst.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox