From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4879 invoked by alias); 5 Aug 2012 18:56:00 -0000 Received: (qmail 4870 invoked by uid 22791); 5 Aug 2012 18:55:59 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_DW,TW_FL,TW_MJ X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 05 Aug 2012 18:55:46 +0000 From: "mjw at redhat dot com" To: systemtap@sourceware.org Subject: [Bug translator/14434] dwflpp sometimes caches incomplete class_type Date: Sun, 05 Aug 2012 18:56:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjw at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2012-q3/txt/msg00154.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14434 --- Comment #2 from Mark Wielaard 2012-08-05 18:55:45 UTC --- Proposed patch/workaround: diff --git a/dwflpp.cxx b/dwflpp.cxx index 3fb50b2..ea93469 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -791,6 +791,32 @@ cache_type_prefix(Dwarf_Die* type) return ""; } +/* GCC might generate a struct/class without DW_AT_declaration, + but that only contains members which have DW_AT_declaration + set. We aren't interested in those. PR14434 (GCC bug #54181). */ +static bool +has_only_decl_members (Dwarf_Die *die) +{ + Dwarf_Die child; + if (dwarf_child(die, &child) != 0) + return false; /* no members */ + + do + { + if (! dwarf_hasattr(&child, DW_AT_declaration)) + return false; /* real member found. */ + int tag = dwarf_tag(&child); + if ((tag == DW_TAG_namespace + || tag == DW_TAG_structure_type + || tag == DW_TAG_class_type) + && ! has_only_decl_members (&child)) + return false; /* real grand child member found. */ + } + while (dwarf_siblingof(&child, &child) == 0); + + return true; /* Tried all children and grandchildren. */ +} + int dwflpp::global_alias_caching_callback(Dwarf_Die *die, bool has_inner_types, const string& prefix, void *arg) @@ -798,7 +824,8 @@ dwflpp::global_alias_caching_callback(Dwarf_Die *die, bool has_inner_types, cu_type_cache_t *cache = static_cast(arg); const char *name = dwarf_diename(die); - if (!name || dwarf_hasattr(die, DW_AT_declaration)) + if (!name || dwarf_hasattr(die, DW_AT_declaration) + || has_only_decl_members(die)) return DWARF_CB_OK; int tag = dwarf_tag(die); -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.