This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/14434] dwflpp sometimes caches incomplete class_type


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]