gdb debug info format

Alexandre Constantino alexandre.constantino at edisoft.pt
Tue Jun 16 10:24:38 UTC 2009


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