From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25423 invoked by alias); 7 Oct 2011 21:27:14 -0000 Received: (qmail 25415 invoked by uid 22791); 7 Oct 2011 21:27:14 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Oct 2011 21:26:58 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p97LQuSd028720 for ; Fri, 7 Oct 2011 14:26:56 -0700 Received: from vcbfo14 (vcbfo14.prod.google.com [10.220.205.14]) by wpaz21.hot.corp.google.com with ESMTP id p97LLu15009458 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 7 Oct 2011 14:26:55 -0700 Received: by vcbfo14 with SMTP id fo14so5645540vcb.1 for ; Fri, 07 Oct 2011 14:26:54 -0700 (PDT) Received: by 10.101.142.31 with SMTP id u31mr1889116ann.112.1318022814708; Fri, 07 Oct 2011 14:26:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.142.31 with SMTP id u31mr1889111ann.112.1318022814439; Fri, 07 Oct 2011 14:26:54 -0700 (PDT) Received: by 10.100.225.14 with HTTP; Fri, 7 Oct 2011 14:26:54 -0700 (PDT) Date: Fri, 07 Oct 2011 21:27:00 -0000 Message-ID: Subject: Make DW_TAG_enumerator's consistent, regardless of containing scope From: Sterling Augustine To: gdb-patches@sourceware.org Content-Type: multipart/mixed; boundary=0016e68f9ec0a91af804aebc19d4 X-System-Of-Record: true 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/msg00208.txt.bz2 --0016e68f9ec0a91af804aebc19d4 Content-Type: text/plain; charset=ISO-8859-1 Content-length: 1426 This patch fixes the issue described in http://sourceware.org/ml/gdb/2011-09/msg00119.html. To recap, consider the testcase below. Dividing the namespace definition into two compilation units and their order on the command-line is essential to see the problem. enum0_main.cc: namespace foo { } int main() { return 0; } enum0.cc: namespace foo { enum B { B_B }; enum B b = B_B; }; saugustine@sterling$ g++ -g enum0_main.cc enum0.cc -o enum-namespace saugustine@sterling$ gdb ./enum-namespace GNU gdb (GDB) 7.3.50.20111007-cvs ... (gdb) p foo::B_B No symbol "B_B" in namespace "foo". (gdb) p foo::B::B_B `foo::B' is not defined as an aggregate type. GDB puts this definition into the partial symbol table as foo::B::B_B, but it should be foo::B_B. After partial symbols have been converted to full symbols, the enum-type is not be included as part of the enumerator's scope. The enclosed patch fixes the situation dropping the enum-type name for all enumerators. The original code was commented that it should do that, but didn't work because it was looking at the enumerator die's parent die, rather than the enumerator die itself. The file split in the test case is required to avoid reading all of namespace foo's symbols in the intermediate symbol lookup. OK to commit? Sterling 2011-10-07 Sterling Augustine * dwarf2read.c (partial_die_parent_scope): Rearrange conditional logic. --0016e68f9ec0a91af804aebc19d4 Content-Type: application/octet-stream; name=enumerator-patch Content-Disposition: attachment; filename=enumerator-patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_gthooyc00 Content-length: 1399 SW5kZXg6IGR3YXJmMnJlYWQuYwo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJD UyBmaWxlOiAvY3ZzL3NyYy9zcmMvZ2RiL2R3YXJmMnJlYWQuYyx2CnJldHJp ZXZpbmcgcmV2aXNpb24gMS41NjEKZGlmZiAtZCAtdSAtcjEuNTYxIGR3YXJm MnJlYWQuYwotLS0gZHdhcmYycmVhZC5jCTEzIFNlcCAyMDExIDIxOjQ0OjI3 IC0wMDAwCTEuNTYxCisrKyBkd2FyZjJyZWFkLmMJNyBPY3QgMjAxMSAxNzo1 MTo1MiAtMDAwMApAQCAtMzg3OCw3ICszODc4LDEwIEBACiAgICAgICByZXR1 cm4gTlVMTDsKICAgICB9CiAKLSAgaWYgKHBhcmVudC0+dGFnID09IERXX1RB R19uYW1lc3BhY2UKKyAgaWYgKHBkaS0+dGFnID09IERXX1RBR19lbnVtZXJh dG9yKQorICAgIC8qIEVudW1lcmF0b3JzIHNob3VsZCBub3QgZ2V0IHRoZSBu YW1lIG9mIHRoZSBlbnVtZXJhdGlvbiBhcyBhIHByZWZpeC4gICovCisgICAg cGFyZW50LT5zY29wZSA9IGdyYW5kcGFyZW50X3Njb3BlOworICBlbHNlIGlm IChwYXJlbnQtPnRhZyA9PSBEV19UQUdfbmFtZXNwYWNlCiAgICAgICB8fCBw YXJlbnQtPnRhZyA9PSBEV19UQUdfbW9kdWxlCiAgICAgICB8fCBwYXJlbnQt PnRhZyA9PSBEV19UQUdfc3RydWN0dXJlX3R5cGUKICAgICAgIHx8IHBhcmVu dC0+dGFnID09IERXX1RBR19jbGFzc190eXBlCkBAIC0zODkzLDkgKzM4OTYs NiBAQAogCQkJCQkgZ3JhbmRwYXJlbnRfc2NvcGUsCiAJCQkJCSBwYXJlbnQt Pm5hbWUsIDAsIGN1KTsKICAgICB9Ci0gIGVsc2UgaWYgKHBhcmVudC0+dGFn ID09IERXX1RBR19lbnVtZXJhdG9yKQotICAgIC8qIEVudW1lcmF0b3JzIHNo b3VsZCBub3QgZ2V0IHRoZSBuYW1lIG9mIHRoZSBlbnVtZXJhdGlvbiBhcyBh IHByZWZpeC4gICovCi0gICAgcGFyZW50LT5zY29wZSA9IGdyYW5kcGFyZW50 X3Njb3BlOwogICBlbHNlCiAgICAgewogICAgICAgLyogRklYTUUgZHJvdy8y MDA0LTA0LTAxOiBXaGF0IHNob3VsZCB3ZSBiZSBkb2luZyB3aXRoCg== --0016e68f9ec0a91af804aebc19d4--