From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: Aditya Chugh Cc: jtc@redback.com, bug-gdb@prep.ai.mit.edu, gdb@sourceware.cygnus.com Subject: Re: MACROS in gdb ??? Date: Wed, 21 Mar 2001 15:59:00 -0000 Message-id: References: <70EB682332F4D41187D6000629AE2C651AE3E4@mail.in.huawei.com> X-SW-Source: 2001-03/msg00184.html Aditya Chugh writes: > Hello Jtc, > Many thanks for your help. > The target I'm using is a Linux machine > running kernel version 2.2.16-22(Red Hat Linux release 7.0) > and the version of gdb is 5.0. > > Also the gdb output looked like this....? > (gdb) p u2IncarnId > $2 = 0 > (gdb) n > (gdb) p u2IncarnId > $3 = 1 > (gdb) p &u2IncarnId > Address requested for identifier "u2IncarnId" which is in a register. > (gdb) > > I found that one of the Makefiles I was using has > CCFLAGS  = -O2 -Wall.After removing the -O2 the problem seems to have been > resolved. > > But does this mean that if we complile using GNU CC with both `-g'  and `-O' > options > GDB will give us wrong results ?? Moreover the same code when run in Visual > Studio 6.0 > prints correct values for u2IncarnId.Does this mean that the debugger in > Visual Studio 6.0 > is better than GDB for optimized code ? Right now? Quite possibly. Optimized debugging support in GDB is only really possible through fully supporting things we don't fully support yet. --Dan