From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1125 invoked by alias); 28 Apr 2007 20:42:51 -0000 Received: (qmail 1116 invoked by uid 22791); 28 Apr 2007 20:42:51 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Apr 2007 21:42:48 +0100 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id 741554B267 for ; Sat, 28 Apr 2007 15:42:47 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id 56C614B262 for ; Sat, 28 Apr 2007 15:42:47 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1Hhtkl-0002RK-1u for gdb-patches@sourceware.org; Sat, 28 Apr 2007 16:42:47 -0400 Date: Sat, 28 Apr 2007 20:45:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [patch] Handle signed addresses in the dwarf2 unwinder Message-ID: <20070428204247.GA8582@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes 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/msg00381.txt.bz2 This is along the same lines as a patch Kevin wrote (and Martin Hunt submitted) several years ago. If we have a MIPS binary with 32-bit addresses, but a 64-bit CORE_ADDR, we should sign extend as necessary. Unfortunately mips-linux testing doesn't really cover this; userspace binaries sit below 0x80000000. However, I'm pretty sure this is necessary to debug programs linked above that point. I'll check it in when I turn on the CFI unwinder for MIPS, which will be just after we figure out what to do about store_typed_address (my last message). Tested on mips64-linux o32 / n32 / n64. -- Daniel Jacobowitz CodeSourcery 2007-04-28 Daniel Jacobowitz * dwarf2-frame.c (read_encoded_value): Correct type. Use DW_EH_PE_signed if appropriate. --- dwarf2-frame.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: gdb/dwarf2-frame.c =================================================================== --- gdb.orig/dwarf2-frame.c 2007-04-27 17:42:37.000000000 -0400 +++ gdb/dwarf2-frame.c 2007-04-27 19:27:15.000000000 -0400 @@ -1446,7 +1446,7 @@ read_encoded_value (struct comp_unit *un base = 0; break; case DW_EH_PE_pcrel: - base = bfd_get_section_vma (unit->bfd, unit->dwarf_frame_section); + base = bfd_get_section_vma (unit->abfd, unit->dwarf_frame_section); base += (buf - unit->dwarf_frame_buffer); break; case DW_EH_PE_datarel: @@ -1477,7 +1477,11 @@ read_encoded_value (struct comp_unit *un } if ((encoding & 0x07) == 0x00) - encoding |= encoding_for_size (ptr_len); + { + encoding |= encoding_for_size (ptr_len); + if (bfd_get_sign_extend_vma (unit->abfd)) + encoding |= DW_EH_PE_signed; + } switch (encoding & 0x0f) {