problem printing global variables in a shared library

Rajeev Bhaskaran rajeevb@gmail.com
Sat Mar 31 06:42:00 GMT 2007


Hi,

I am using gdb 6.5 to debug programs on linux 2.6.14-7, PQ3(MPC8555E) processor.

The global variables(initialized) in a shared library are printed
incorrectly(junk) by gdb print command.
Printing the same variables from program being debugged using printf,
displays the correct value.
The same problem is noticed while printing values of "errno" global variable.

If the global variable in shared library is declared as a static type,
it is displayed correctly by gdb.
Code optimization is turned off while debugging. No problems with
global variables in an executable.
Problem is seen during remote debugging(with gdbserver) as well as
during direct debugging on target with gdb.

Please help. Any clues on what could i be doing wrong ?

Thanks,
Rajeev



More information about the Gdb mailing list