public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/51410] New: duplicate variable DIE
@ 2011-12-04 16:35 mark at gcc dot gnu.org
  2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mark at gcc dot gnu.org @ 2011-12-04 16:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51410

             Bug #: 51410
           Summary: duplicate variable DIE
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mark@gcc.gnu.org
                CC: tromey@redhat.com


This used to confuse systemtap, it has been fixed by searching the symbol table
to find the address of a variable if no location description is available if
the var DIE is marked external. It can certainly be argued that systemtap
should just search harder and find the other var DIE that does contain a
location description. But it sure is confusing IMHO.

Given the following source code:

int x;

int main(int argc, char **argv)
{
  return x;
}

compiled with gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
$ gcc -g -O2 -o /tmp/x x.c

produces the following .debug_info:

DWARF section [28] '.debug_info' at offset 0x6a5:
 [Offset]
 Compilation unit at offset 0:
 Version: 3, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit
           producer             (strp) "GNU C 4.6.1 20110908 (Red Hat 4.6.1-9)"
           language             (data1) ISO C89 (1)
           name                 (string) "x.c"
           comp_dir             (strp) "/home/mark/src/tests"
           ranges               (data4) range list [     0]
           low_pc               (addr) 0000000000
           entry_pc             (addr) 0000000000
           stmt_list            (data4) 0
 [    29]    subprogram
             external             (flag) Yes
             name                 (strp) "main"
             decl_file            (data1) 1
             decl_line            (data1) 3
             prototyped           (flag) Yes
             type                 (ref4) [    61]
             low_pc               (addr) 0x080482e0 <main>
             high_pc              (addr) 0x080482e6
             frame_base           (block1)               [   0] call_frame_cfa
             sibling              (ref4) [    61]
 [    44]      formal_parameter
               name                 (strp) "argc"
               decl_file            (data1) 1
               decl_line            (data1) 3
               type                 (ref4) [    61]
               location             (block1)                 [   0] fbreg 0
 [    52]      formal_parameter
               name                 (strp) "argv"
               decl_file            (data1) 1
               decl_line            (data1) 3
               type                 (ref4) [    68]
               location             (block1)                 [   0] fbreg 4
 [    61]    base_type
             byte_size            (data1) 4
             encoding             (data1) signed (5)
             name                 (string) "int"
 [    68]    pointer_type
             byte_size            (data1) 4
             type                 (ref4) [    6e]
 [    6e]    pointer_type
             byte_size            (data1) 4
             type                 (ref4) [    74]
 [    74]    base_type
             byte_size            (data1) 1
             encoding             (data1) signed_char (6)
             name                 (strp) "char"
 [    7b]    variable
             name                 (string) "x"
             decl_file            (data1) 1
             decl_line            (data1) 1
             type                 (ref4) [    61]
             external             (flag) Yes
             declaration          (flag) Yes
 [    86]    variable
             name                 (string) "x"
             decl_file            (data1) 1
             decl_line            (data1) 1
             type                 (ref4) [    61]
             external             (flag) Yes
             location             (block1)               [   0] addr 0x8049634
<x>

Note that there are two variable DIEs for x, 7b and 86, neither of which is
references in the rest of the CU. Since 86 doesn't refer to 7b, it isn't clear
to me how a consumer can know this is the same variable. In any case it seems
redundant to have both, even if the consumer is supposed to discard the one
marked as declaration.

This isn't an issue for static variables, which will have only one var DIE. It
is also a regression compared to gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
which would produce only one variable DIE for x.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-02 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-12-05 17:13 ` jakub at gcc dot gnu.org
2011-12-05 20:51 ` jakub at gcc dot gnu.org
2011-12-05 21:03 ` [Bug debug/51410] [4.5/4.6 " jakub at gcc dot gnu.org
2011-12-08 13:42 ` jakub at gcc dot gnu.org
2012-06-20 13:10 ` [Bug debug/51410] [4.5 " rguenth at gcc dot gnu.org
2012-07-02 10:18 ` rguenth at gcc dot gnu.org

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).