From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16494 invoked by alias); 17 Oct 2011 07:13:27 -0000 Received: (qmail 16484 invoked by uid 22791); 17 Oct 2011 07:13:25 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Oct 2011 07:13:11 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3ADA0CB02A6; Mon, 17 Oct 2011 09:13:11 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CwGru-EXxHG6; Mon, 17 Oct 2011 09:13:01 +0200 (CEST) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 6F4AFCB01EC; Mon, 17 Oct 2011 09:13:01 +0200 (CEST) Subject: Re: [patch#2] fetch result of locdesc expressions as integer (not address) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Tristan Gingold In-Reply-To: <20111016233208.GV19246@adacore.com> Date: Mon, 17 Oct 2011 07:59:00 -0000 Cc: Jan Kratochvil , gdb-patches@sourceware.org, Ulrich Weigand Content-Transfer-Encoding: quoted-printable Message-Id: <12B19AE2-D934-499E-82A1-23EE09AAE872@adacore.com> References: <1317676214-7683-1-git-send-email-brobecker@adacore.com> <20111009163457.GA1767@host1.jankratochvil.net> <20111016233208.GV19246@adacore.com> To: Joel Brobecker 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: 2011-10/txt/msg00456.txt.bz2 On Oct 17, 2011, at 1:32 AM, Joel Brobecker wrote: >> It is not an offset, the problem is it really is an address. >>=20 >> 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 add= ress >> # of the member entry. >=20 > Ah - I missed that part of the standard, and that helps understand > the command that pushes the null address indeed. >=20 >> Both former and current FSF GDB pushes bogus address 0 first >> simulating base address of the struct. >> - stack[stacki] =3D 0; >> - stack[++stacki] =3D 0; >> + /* DW_AT_data_member_location expects the structure address to be pus= hed on >> + the stack. Simulate the offset by address 0. */ >> + dwarf_expr_push_address (ctx, 0, 0); >=20 > 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. >=20 >> 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 =3D=3D 0) >> return 0; >>=20 >> return ((x) | AVR_SMEM_START); >> } >> Unfortunately I cannot argue about AVR arch issues. >=20 > 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. SRAM address 0 is valid, but if you convert NULL to a non-0 value, many thi= ngs get broken! Tristan. >=20 >> Joel, do you run the testsuite with iron AVR or is it OK to run it >> some way with sim/avr/ ? >=20 > 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. >=20 >> gdb/ >> 2011-10-09 Jan Kratochvil >>=20 >> 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. >>=20 >> gdb/testsuite/ >> 2011-10-09 Jan Kratochvil >>=20 >> * 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. >=20 > 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. >=20 > --=20 > Joel