[Bug debug/39563] New: C block scopes have no DW_TAG_lexical_block

jan dot kratochvil at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 26 17:12:00 GMT 2009


GNU C 4.4.0 20090326 (experimental)
GDB variables lookup does not match the C code lookup.
Similiar C++ code in PR debug/39524 uses DW_TAG_lexical_block.

$ gdb -q ./externvar
(gdb) l 1
1       #include <stdlib.h>
2       
3       int var = 2;
4       
5       int
6       main (void)
7       {
8         int var = 1;
9       
10        if (var != 1)
11          abort ();
12      
13        {
14          extern int var;
15      
16          if (var != 2)
17            abort ();
18        }
19      
20        return 0;
21      }
(gdb) b 16
Breakpoint 1 at 0x4004d2: file externvar.c, line 16.
(gdb) r
Starting program: /tmp/externvar 
Breakpoint 1, main () at externvar.c:16
16          if (var != 2)
(gdb) p var
$1 = 1
(gdb) c
Continuing.
Program exited normally.
(gdb) q
------------------------------------------------------------------------------
    < c>   DW_AT_producer    : (indirect string, offset: 0xe): GNU C 4.4.0
20090326 (experimental)      
 <1><7d>: Abbrev Number: 5 (DW_TAG_subprogram)
    <7f>   DW_AT_name        : (indirect string, offset: 0x63): main    
    <8a>   DW_AT_low_pc      : 0x4004b8 
    <92>   DW_AT_high_pc     : 0x4004e9 
 <2><a2>: Abbrev Number: 6 (DW_TAG_variable)
    <a3>   DW_AT_name        : var      
    <a9>   DW_AT_type        : <0x34>   
    <ad>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)
 <1><b1>: Abbrev Number: 7 (DW_TAG_variable)
    <b2>   DW_AT_name        : var      
    <b8>   DW_AT_type        : <0x34>   
    <bc>   DW_AT_external    : 1        
    <bd>   DW_AT_location    : 9 byte block: 3 70 8 60 0 0 0 0 0       
(DW_OP_addr: 600870)

Missing there something like:
 <2><c0>: Abbrev Number: 6 (DW_TAG_lexical_block)
    <c1>   DW_AT_low_pc      : 0x4005b2 
    <c9>   DW_AT_high_pc     : 0x4005c2 
 <3><b1>: Abbrev Number: 7 (DW_TAG_variable)
    <b2>   DW_AT_name        : var      
    <b8>   DW_AT_type        : <0x34>   
    <bc>   DW_AT_external    : 1        
    <bd>   DW_AT_location    : 9 byte block: 3 70 8 60 0 0 0 0 0       
(DW_OP_addr: 600870)


-- 
           Summary: C block scopes have no DW_TAG_lexical_block
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


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



More information about the Gcc-bugs mailing list