This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/43989] New: g++ missing the debug information of local static variable
- From: "pizhoupeter at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 May 2010 05:59:12 -0000
- Subject: [Bug debug/43989] New: g++ missing the debug information of local static variable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++ misses the debug information of local static variable but gcc doesn't.
gcc version: 4.1.2 20080704 (Red Hat 4.1.2-44)
g++ version: 4.1.2 20080704 (Red Hat 4.1.2-44)
OS version: Red Hat Enterprise Linux Client release 5.3 (Tikanga)
code stored in the file myTest.c:
void CStyleFunction()
{
static int variableInFunction = 2;
}
int main()
{
static int varaibleInMain = 1;
CStyleFunction();
return 0;
}
gcc build command: gcc -g myTest.c -o c.out
g++ build command: g++ -g myTest.c -o cpp.out
Then use the command to print out the debug information:
objdump -W c.out
objdump -W cpp.out
It can be seen that the debug information of static local variable
'variableInFunction' and 'variableInMain' is missing in cpp.out while it isn't
in c.out. As a result, gdb can show the value of the former while it can't show
the value of the latter.
--
Summary: g++ missing the debug information of local static
variable
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pizhoupeter at hotmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43989