public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "mjw at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/14434] dwflpp sometimes caches incomplete class_type
Date: Sun, 05 Aug 2012 18:51:00 -0000	[thread overview]
Message-ID: <bug-14434-6586-ywMPAj07fx@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14434-6586@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=14434

--- Comment #1 from Mark Wielaard <mjw at redhat dot com> 2012-08-05 18:51:29 UTC ---
The reason it sometimes fails is that dwflpp::global_alias_caching_callback
puts types in an unordered_map<std::string, Dwarf_Die> (cu_type_cache_t) and
depending on the order this map is filled in it might pick the "wrong"
class_type for Heap.

It can pick the wrong one since there are two in this example:

$ eu-readelf --debug-dump=info prog

[...]
 [     b]  compile_unit
           producer             (strp) "GNU C++ 4.7.1 20120629 (Red Hat
4.7.1-1) -fpreprocessed -mtune=generic -march=x86-64 -g -O2"
           language             (data1) C++ (4)
           name                 (strp) "main.cxx"
           comp_dir             (strp) "/home/mark/src/tests/cxx-decl"
           ranges               (sec_offset) range list [     0]
           low_pc               (addr) 000000000000000000
           stmt_list            (sec_offset) 0
[...]
 [   289]    class_type
             name                 (strp) "Heap"
             byte_size            (data1) 16
             decl_file            (data1) 6
             decl_line            (data1) 3
             sibling              (ref4) [   2a6]
 [   295]      subprogram
               external             (flag_present) Yes
               name                 (strp) "header_size"
               decl_file            (data1) 6
               decl_line            (data1) 11
               linkage_name         (strp) "_ZN4Heap11header_sizeEv"
               type                 (ref4) [    30]
               accessibility        (data1) public (1)
               declaration          (flag_present) Yes
 [   38e]  compile_unit
           producer             (strp) "GNU C++ 4.7.1 20120629 (Red Hat
4.7.1-1) -fpreprocessed -mtune=generic -march=x86-64 -g -O2"
           language             (data1) C++ (4)
           name                 (strp) "heap.cxx"
           comp_dir             (strp) "/home/mark/src/tests/cxx-decl"
           low_pc               (addr) 0x00000000004005b0
<_ZN4Heap11header_sizeEv>
           high_pc              (addr) 0x00000000004005ec
           stmt_list            (sec_offset) 220
[...]
 [   610]    class_type
             name                 (strp) "Heap"
             byte_size            (data1) 16
             decl_file            (data1) 5
             decl_line            (data1) 3
             sibling              (ref4) [   67e]
 [   61c]      member
               name                 (strp) "_memory"
               decl_file            (data1) 5
               decl_line            (data1) 6
               type                 (ref4) [   412]
               data_member_location (data1) 0
 [   628]      member
               name                 (strp) "_size"
               decl_file            (data1) 5
               decl_line            (data1) 7
               type                 (ref4) [   3b7]
               data_member_location (data1) 8
 [   634]      subprogram
               external             (flag_present) Yes
               name                 (strp) "Heap"
               decl_file            (data1) 5
               decl_line            (data1) 9
               accessibility        (data1) public (1)
               declaration          (flag_present) Yes
               object_pointer       (ref4) [   644]
               sibling              (ref4) [   64a]
 [   644]        formal_parameter
                 type                 (ref4) [   67e]
                 artificial           (flag_present) Yes
 [   64a]      subprogram
               external             (flag_present) Yes
               name                 (strp) "allocate"
               decl_file            (data1) 5
               decl_line            (data1) 10
               linkage_name         (strp) "_ZN4Heap8allocateEm"
               type                 (ref4) [   410]
               accessibility        (data1) public (1)
               declaration          (flag_present) Yes
               object_pointer       (ref4) [   662]
               sibling              (ref4) [   66d]
 [   662]        formal_parameter
                 type                 (ref4) [   67e]
                 artificial           (flag_present) Yes
 [   667]        formal_parameter
                 type                 (ref4) [   3b7]
 [   66d]      subprogram
               external             (flag_present) Yes
               name                 (strp) "header_size"
               decl_file            (data1) 5
               decl_line            (data1) 11
               linkage_name         (strp) "_ZN4Heap11header_sizeEv"
               type                 (ref4) [   3b7]
               accessibility        (data1) public (1)
               declaration          (flag_present) Yes

Note how the first one in the main.cxx compile_unit is incomplete.
It only contains the header_size subprogram member (since that is the only
member used in main.cxx).

By just looking at the class_type DIE we cannot tell which one we need though,
since both [   289] and [   610] look identical, both have a byte_size
attribute and neither is marked as declaration.

I think this is a gcc DWARF generation bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54181
" partial DW_TAG_class_type generated with DW_AT_byte_size and without
DW_AT_declaration"

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

  reply	other threads:[~2012-08-05 18:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 18:25 [Bug translator/14434] New: " mjw at redhat dot com
2012-08-05 18:51 ` mjw at redhat dot com [this message]
2012-08-05 18:56 ` [Bug translator/14434] " mjw at redhat dot com
2012-08-06 22:39 ` mjw at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14434-6586-ywMPAj07fx@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).