[LLVMbugs] [Bug 3223] New: Debug information gives variables the wrong types

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Dec 16 14:23:55 PST 2008


           Summary: Debug information gives variables the wrong types
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=2308)
 --> (http://llvm.org/bugs/attachment.cgi?id=2308)
Sample program showing incorrect debug information

With llvm-gcc checked out at r60958, gdb gives the wrong types to variables.
The 2.4 release did not have this problem (although it did have a different
problem with arrays).

$ ~/opensource/llvm-gcc/trunk/install/bin/llvm-gcc -g -o bad_types bad_types.c 
$ gdb bad_types
GNU gdb 6.8-gg11
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux"...
(gdb) b main
Breakpoint 1 at 0x400438: file bad_types.c, line 2.
(gdb) run
Starting program: /home/jyasskin/tmp/bad_types 

Breakpoint 1, main () at bad_types.c:2
2         char* ptr = "Hello";
(gdb) n
3         int i = 2;
(gdb) n
4         int arr[] = {1,2,3,4};
(gdb) n
5       }
(gdb) p ptr
$1 = (void *) 0x400570
(gdb) p i
$2 = {2, 1, 2, 3}
(gdb) p arr
$3 = {1, 2, 3, 4}

If 'i' is the last variable, it correctly gets printed as an int rather than an
array.  The somewhat annoying workaround is to cast things to the right types
before printing them.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list