From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8807 invoked by alias); 15 Jul 2004 17:32:29 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 8788 invoked from network); 15 Jul 2004 17:32:28 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 15 Jul 2004 17:32:28 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6FHWSe1026442 for ; Thu, 15 Jul 2004 13:32:28 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6FHWS017398; Thu, 15 Jul 2004 13:32:28 -0400 Received: from [172.16.50.19] (vpn50-19.rdu.redhat.com [172.16.50.19]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i6FHWRoI015499; Thu, 15 Jul 2004 13:32:27 -0400 Subject: Re: dwarf2-frame.c question for maintainers From: "Martin M. Hunt" To: Andrew Cagney Cc: Mark Kettenis , gdb@sources.redhat.com In-Reply-To: <40F58971.7000304@gnu.org> References: <1089749730.3026.18.camel@dragon> <40F56CCA.5080106@gnu.org> <1089827266.3010.2.camel@dragon> <40F58971.7000304@gnu.org> Content-Type: text/plain Organization: Red Hat Inc. Message-Id: <1089912741.3028.14.camel@dragon> Mime-Version: 1.0 Date: Thu, 15 Jul 2004 17:40:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00172.txt.bz2 On Wed, 2004-07-14 at 12:28, Andrew Cagney wrote: > >>> How come extract_typed_address, in read_reg, doesn't sign extend? > > > > > > I should have explained that. It does. However extract_typed_address is > > incorrect because it makes the invalid assumption that sizeof(address) > > == sizeof(register). So that has to go and be replaced with something > > like > > extract_signed_integer (buf, register_size (current_gdbarch, regnum)); > > You mean the builtin_type_void_data_ptr parameter to > extract_typed_address? Ah. > > I see builtin_type_void_data_ptr dates back to 1.1 (Mark?). It could > instead use the register's type? extract_typed_address calls extract_[un]signed_integer with size = TYPE_LENGTH of builtin_type_void_data_ptr. Here's exactly what I am seeing. Maybe you can tell me if read_reg is the problem. For example big-endian Mips, with o64 or (eabi and mlong32): (registers are 64 bits and pointers are 32 bits) read_reg calls frame_unwind_register (next_frame, regnum, buf) after that, buf has something like ffffffff801fffb8 Now if you do extract_typed_address(), it knows addresses are 4 bytes and returns 0xffffffff sign extended to 0xfffffffffffffff If instead, you call extract_[un]signed_integer((buf, register_size (current_gdbarch, regnum)), it returns 0xffffffff801fffb8 The real problem here is the the size. AFAICT, sign-extension here is unimportant; I get the same test results calling extract_unsigned_integer in read_reg() for mips, because, as you can see, nothing needs extending, just the whole register needs read. However, I can't prove that is always the case because I am not familiar enough with the code. -- Martin M. Hunt Red Hat Inc.