From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23928 invoked by alias); 20 Mar 2009 18:22:24 -0000 Received: (qmail 23771 invoked by uid 22791); 20 Mar 2009 18:22:23 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN 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; Fri, 20 Mar 2009 18:22:18 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4C22F2BAC51; Fri, 20 Mar 2009 14:22:16 -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 nqecwSJ7eL46; Fri, 20 Mar 2009 14:22:16 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 306A42BAC30; Fri, 20 Mar 2009 14:22:16 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 93C81F5CFA; Fri, 20 Mar 2009 14:22:15 -0400 (EDT) Date: Fri, 20 Mar 2009 18:39:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch/rfc] Recognize non-DW_AT_location symbols Message-ID: <20090320182215.GC12530@adacore.com> References: <20090316202040.GA27070@host0.dyn.jankratochvil.net> <20090320150248.GA12530@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <20090320150248.GA12530@adacore.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-03/txt/msg00411.txt.bz2 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2382 > > * zero-length DW_AT_location should be the same as missing DW_AT_location. > > https://fedorahosted.org/pipermail/elfutils-devel/2009-March/000180.html Here a few thoughts after looking more closely at this. After reproducing the problem thanks to your testsuite patch, I initially did the same thing as you did, which was to add the symbol for local symbols as well. But that caused the regressions you mentioned in one of the C++ testcases. It's about a variable that's declared inside an anonymous namespaces. I think that our mistake was to add all non-external variables without checking that they were "complete" yet. Thus, I changed the patch to the attached. Basically, if it is a non-external symbol but at the same time a "declaration", then we should wait for the "defining" declaration before adding it to the current local scope. That fixes the C++ problem, and I was fairly confident about it but a testcase run seems to indicate the following regressions: +------------+------------+----------------------------------------------------+ | PASS | FAIL | callfuncs.exp: gdb function calls preserve reg ... | | | | ... ister contents | | PASS | FAIL | callfuncs.exp: continue after stop in call dum ... | | | | ... my preserves register contents | | PASS | FAIL | callfuncs.exp: finish after stop in call dummy ... | | | | ... preserves register contents | | PASS | FAIL | callfuncs.exp: return after stop in call dummy ... | | | | ... preserves register contents | | PASS | FAIL | callfuncs.exp: nested call dummies preserve re ... | | | | ... gister contents | +------------+------------+----------------------------------------------------+ I'm a little surprised at these regressions, as I don't see how the dwarf2read change we're making can have an impact on this. It's particularly more puzzling that I did a diff of the exact output of before and after taken from the gdb.log file, and diff said there was no difference. I'm rerunning the testsuite now, to see if it might be transient, but I'm wondering if I'm looking at the right reference output.... -- Joel --ikeVEW9yuYc//A+q Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="loc.diff" Content-length: 666 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index feb57b0..cba9d75 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7658,6 +7658,12 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) SYMBOL_CLASS (sym) = LOC_UNRESOLVED; add_symbol_to_list (sym, &global_symbols); } + else if (!die_is_declaration (die, cu)) + { + /* Use the default LOC_OPTIMIZED_OUT class. */ + gdb_assert (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT); + add_symbol_to_list (sym, cu->list_in_scope); + } } break; case DW_TAG_formal_parameter: --ikeVEW9yuYc//A+q--