From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2478 invoked by alias); 12 Apr 2004 22:54:28 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2281 invoked from network); 12 Apr 2004 22:54:26 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sources.redhat.com with SMTP; 12 Apr 2004 22:54:26 -0000 Received: from hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 4008E445BB2 for ; Tue, 13 Apr 2004 00:54:26 +0200 (CEST) To: gdb-patches@sources.redhat.com Subject: [PATCH] Fix crash with libunwind support From: Andreas Schwab X-Yow: Send your questions to ``ASK ZIPPY'', Box 40474, San Francisco, CA 94140, USA Date: Mon, 12 Apr 2004 22:54:00 -0000 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-04/txt/msg00265.txt.bz2 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 * 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."