[lldb-dev] [Bug 24074] New: lldb incorrectly displays typedefs in different lexical scopes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 9 05:28:16 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24074

            Bug ID: 24074
           Summary: lldb incorrectly displays typedefs in different
                    lexical scopes
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: varvara.rainchik at gmail.com
    Classification: Unclassified

cat test.c
int main( void ) {
    int c = 0;
    while (c <= 1) {
        if (c != 1) {
            typedef int a;
            a b;
            b = 0;
        } else {
            typedef float a;
            a b;
            b = 0;
        }
        c++;
    }  
    return 0;
}

I'm compiling this test with icc:
icc -c -g -O0 test.c
icc -o test.exe -O0 -g test.o

I see that icc generates correct debug info: each typedef goes to its own
lexical scope.
dwarfdump test.o
...
0x000000e7:         TAG_lexical_block [5] *
                     AT_decl_line( 4 )
                     AT_decl_file( "/Applications/test/test.c" )
                     AT_low_pc( 0x000000000000001f )
                     AT_high_pc( 0x0000000000000028 )

0x000000fa:             TAG_variable [4]
                         AT_decl_line( 6 )
                         AT_decl_file( "/Applications/test/test.c" )
                         AT_name( "b" )
                         AT_type( {0x00000106} ( a ) )
                         AT_location( rbp-12 )

0x00000106:             TAG_typedef [6]
                         AT_decl_line( 5 )
                         AT_decl_file( "/Applications/test/test.c" )
                         AT_name( "a" )
                         AT_type( {0x000000b6} ( int ) )

0x0000010f:             NULL

0x00000110:         TAG_lexical_block [5] *
                     AT_decl_line( 8 )
                     AT_decl_file( "/Applications/test/test.c" )
                     AT_low_pc( 0x0000000000000028 )
                     AT_high_pc( 0x0000000000000030 )

0x00000123:             TAG_variable [4]
                         AT_decl_line( 10 )
                         AT_decl_file( "/Applications/test/test.c" )
                         AT_name( "b" )
                         AT_type( {0x0000012f} ( a ) )
                         AT_location( rbp-8 )

0x0000012f:             TAG_typedef [6]
                         AT_decl_line( 9 )
                         AT_decl_file( "/Applications/test/test.c" )
                         AT_name( "a" )
                         AT_type( {0x0000013a} ( float ) )

0x00000138:             NULL


But, lldb displays wrong type for second typedef:

lldb test.exe
(lldb) target create "test.exe"
Current executable set to 'test.exe' (x86_64).
(lldb) b 7
Breakpoint 1: where = test.exe`main + 31 at test.c:7, address =
0x0000000100000f97
(lldb) b 11
Breakpoint 2: where = test.exe`main + 40 at test.c:11, address =
0x0000000100000fa0
(lldb) r
Process 3620 launched: '/Applications/test/test.exe' (x86_64)
Process 3620 stopped
* thread #1: tid = 0xed87, 0x0000000100000f97 test.exe`main + 31 at test.c:7,
queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f97 test.exe`main + 31 at test.c:7
   4               if (c != 1) {
   5                   typedef int a;
   6                   a b;
-> 7                   b = 0;
   8               } else {
   9                   typedef float a;
   10                  a b;
(lldb) type lookup a
Best match found in /Applications/test/test.exe:
id = {0x100000106}, name = "a", byte-size = 4, decl = test.c:5, clang_type =
"typedef a"
     typedef 'a': id = {0x1000000b6}, name = "int", byte-size = 4, clang_type =
"int"

(lldb) c
Process 3620 resuming
Process 3620 stopped
* thread #1: tid = 0xed87, 0x0000000100000fa0 test.exe`main + 40 at test.c:11,
queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
    frame #0: 0x0000000100000fa0 test.exe`main + 40 at test.c:11
   8               } else {
   9                   typedef float a;
   10                  a b;
-> 11                  b = 0;
   12              }
   13              c++;
   14          }  
(lldb) type lookup a
Best match found in /Applications/test/test.exe:
id = {0x100000106}, name = "a", byte-size = 4, decl = test.c:5, clang_type =
"typedef a"
     typedef 'a': id = {0x1000000b6}, name = "int", byte-size = 4, clang_type =
"int"

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150709/836eafa5/attachment.html>


More information about the lldb-dev mailing list