From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16807 invoked by alias); 16 Oct 2011 23:32:28 -0000 Received: (qmail 16796 invoked by uid 22791); 16 Oct 2011 23:32:27 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Oct 2011 23:32:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3C3812BB19C; Sun, 16 Oct 2011 19:32:12 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id s3uSEezxhV0b; Sun, 16 Oct 2011 19:32:12 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 018702BB02C; Sun, 16 Oct 2011 19:32:12 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id E3C41145615; Sun, 16 Oct 2011 19:32:08 -0400 (EDT) Date: Mon, 17 Oct 2011 01:56:00 -0000 From: Joel Brobecker To: Jan Kratochvil , Tristan Gingold Cc: gdb-patches@sourceware.org, Ulrich Weigand Subject: Re: [patch#2] fetch result of locdesc expressions as integer (not address) Message-ID: <20111016233208.GV19246@adacore.com> References: <1317676214-7683-1-git-send-email-brobecker@adacore.com> <20111009163457.GA1767@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111009163457.GA1767@host1.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2011-10/txt/msg00451.txt.bz2 > It is not an offset, the problem is it really is an address. > > DWARF-4: > # The beginning address is pushed on the DWARF stack before the location > # description is evaluated; the result of the evaluation is the base address > # of the member entry. Ah - I missed that part of the standard, and that helps understand the command that pushes the null address indeed. > Both former and current FSF GDB pushes bogus address 0 first > simulating base address of the struct. > - stack[stacki] = 0; > - stack[++stacki] = 0; > + /* DW_AT_data_member_location expects the structure address to be pushed on > + the stack. Simulate the offset by address 0. */ > + dwarf_expr_push_address (ctx, 0, 0); What we could perhaps try is to push 'integer-to-address(0)', rather than zero itself. Then, if we want the offset, then subtract that same integer-to-address(0) value from the result. > While trying to fix it I faced for example the exception for address 0 - isn't > it broken for AVR? Isn't SRAM address 0 a valid address? > static CORE_ADDR > avr_make_saddr (CORE_ADDR x) > { > /* Return 0 for NULL. */ > if (x == 0) > return 0; > > return ((x) | AVR_SMEM_START); > } > Unfortunately I cannot argue about AVR arch issues. Me neither, and the documentations I have been able to find wheren't very clear or complete. I suspect that this is because it's not typical CPU, but rather a micro controler. I'm copying Tristan who knows this architecture better. > Joel, do you run the testsuite with iron AVR or is it OK to run it > some way with sim/avr/ ? We run our testsuite with the GDB simulator. For the official testsuite, there should be a way to do it, and I have an email from Kevin that should put me on the track, but for now, we have never really done it. > gdb/ > 2011-10-09 Jan Kratochvil > > Revert: > 2011-07-27 Jan Kratochvil > * dwarf2expr.c (ctx_no_read_reg): New function. > * dwarf2expr.h (ctx_no_read_reg): New declaration. > * dwarf2read.c (read_2_signed_bytes, read_4_signed_bytes): Remove. > (decode_locdesc_read_mem, decode_locdesc_ctx_funcs): New. > (decode_locdesc): Replace by a caller of dwarf_expr_eval. > > gdb/testsuite/ > 2011-10-09 Jan Kratochvil > > * gdb.dwarf2/dw2-simple-locdesc.exp (p &s.shl): KFAIL it. > Revert the part of: > 2011-07-27 Jan Kratochvil > * gdb.dwarf2/dw2-stack-boundary.exp (check partial symtab errors): > Change the expected string. Based on the reasons you provided, it seems indeed that this patch is no longer really necessary. On the other hand, you are right to say that it's a bit of a miracle that things are working so far. -- Joel