From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28526 invoked by alias); 30 Apr 2007 12:41:11 -0000 Received: (qmail 28512 invoked by uid 22791); 30 Apr 2007 12:41:09 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Apr 2007 13:41:05 +0100 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1HiVBc-0006J8-00; Mon, 30 Apr 2007 13:41:00 +0100 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1HiVBW-0002By-00; Mon, 30 Apr 2007 13:40:54 +0100 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1HiVBW-0007Zl-E6; Mon, 30 Apr 2007 13:40:54 +0100 Date: Mon, 30 Apr 2007 13:00:00 -0000 From: "Maciej W. Rozycki" To: Daniel Jacobowitz cc: gdb-patches@sourceware.org, "Maciej W. Rozycki" Subject: Re: [rfc] dwarf2 unwinder and MIPS n32 In-Reply-To: <20070428202914.GA8077@caradoc.them.org> Message-ID: References: <20070428202914.GA8077@caradoc.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00406.txt.bz2 On Sat, 28 Apr 2007, Daniel Jacobowitz wrote: > Maybe if the size of the register != the size of a void * we should > store it as an unsigned integer. But that seems hackish to me. Of course MIPS addresses are signed, so if you have a stack pointer in KSEG0 (e.g. 0x8fff0000), you want to store it as a signed integer, don't you? Anyway, I have the following patch waiting in the queue for submission -- perhaps it is less hackish. ;-) 2007-04-30 Maciej W. Rozycki * dwarf2-frame.c (read_reg): Extract an address using the width of the register to be used to hold it as the size. (dwarf2_frame_prev_register): Store an address using the width of the holding register as the size. It can certainly jump the queue if you find it useful. ;-) Maciej 13118.diff Index: gdb/src/gdb/dwarf2-frame.c =================================================================== --- gdb.orig/src/gdb/dwarf2-frame.c 2007-02-13 13:51:55.000000000 +0000 +++ gdb/src/gdb/dwarf2-frame.c 2007-02-13 13:51:56.000000000 +0000 @@ -229,6 +229,7 @@ static CORE_ADDR read_reg (void *baton, int reg) { + struct type reg_void_data_ptr = *builtin_type_void_data_ptr; struct frame_info *next_frame = (struct frame_info *) baton; struct gdbarch *gdbarch = get_frame_arch (next_frame); int regnum; @@ -236,6 +237,8 @@ regnum = DWARF2_REG_TO_REGNUM (reg); + TYPE_LENGTH(®_void_data_ptr) = register_size (gdbarch, regnum); + buf = alloca (register_size (gdbarch, regnum)); frame_unwind_register (next_frame, regnum, buf); @@ -244,7 +247,7 @@ under the covers, and this makes more sense for non-pointer registers. Maybe read_reg and the associated interfaces should deal with "struct value" instead of CORE_ADDR. */ - return unpack_long (register_type (gdbarch, regnum), buf); + return extract_typed_address (buf, ®_void_data_ptr); } static void @@ -1020,10 +1023,13 @@ enum lval_type *lvalp, CORE_ADDR *addrp, int *realnump, gdb_byte *valuep) { + struct type reg_void_data_ptr = *builtin_type_void_data_ptr; struct gdbarch *gdbarch = get_frame_arch (next_frame); struct dwarf2_frame_cache *cache = dwarf2_frame_cache (next_frame, this_cache); + TYPE_LENGTH(®_void_data_ptr) = register_size (gdbarch, regnum); + switch (cache->reg[regnum].how) { case DWARF2_FRAME_REG_UNDEFINED: @@ -1132,7 +1138,7 @@ if (valuep) { /* Store the value. */ - store_typed_address (valuep, builtin_type_void_data_ptr, cache->cfa); + store_typed_address (valuep, ®_void_data_ptr, cache->cfa); } break;