gdb debug info format

Alexandre Constantino alexandre.constantino at edisoft.pt
Tue Jun 16 13:40:12 UTC 2009


That is strange. Using -O0 has always done the trick for me.
That may be a problem with that specific gdb version or the target... I don't know.
Maybe someone else using that gdb (and GCC) version and cpu target can comment on this.


On Tuesday 16 June 2009, Leon Pollak wrote:
> Thanks, Alexandre.
> I use '-O0' optimization and do not see local (on the stack) variables. I also 
> can not determine why sometimes I do see locals, and sometimes - no.
> I applied your recommendations with -g3 -ggdb3  - no effect...:-(
> 
> On Tuesday June 16 2009, Alexandre Constantino wrote:
> > Hello,
> >
> > (not sure if this will be much help, but...)
> >
> > GCC can remove "unused" variables from the code, e.g. a variable whose sole
> > purpose is to save the return value from a function. Possible
> > "workarounds":
> > - Optimizations should be removed for debug purposes.
> >   (not acceptable on most situations)
> > - A dummy condition must be done, e.g. "if (foo = 123456)
> > dummy_fun_call(foo);" (not very friendly)
> >
> > If this is a macro variable it will be removed, unless level 3 of debug
> > information is used.
> >
> > Using -ggdb3 may provide the greater amount of debug information to your
> > program.
> >
> >
> > Best regards,
> > Alexandre
> >
> > On Tuesday 16 June 2009, Leon Pollak wrote:
> > > Hello,
> > >
> > > I am using gdb 6.8 ("This GDB was configured as
> > > "--host=x86_64-redhat-linux- gnu --target=powerpc-rtems4.9") and
> > > rtems-4.9 tools for PPC.
> > >
> > > I rather often  encounter the message "No symbol "foo" in current
> > > context." for local variables.
> > > Manual says that I may try to change the debug info format, may be to
> > > DWARF2. But this does not help too.
> > >
> > > Can somebody advice something?
> 
> 





More information about the users mailing list