gdb 6.5 doesn't see local variables

Patrik Jonsson patrik@ucolick.org
Fri May 18 19:28:00 GMT 2007


Hi all,

I'm trying to debug a C++ program (compiled with gcc 4.1.1) with gdb
6.5-15.fc6rh (on a FC6 x86_64 machine), and I'm experiencing a most
vexing problem.  I'm breaking the program in a constructor and want to
look at the local variables, but gdb says there are no such symbols in
the current context. The program is compiled with -g -O0.

Here's some code:

mcrx::mappings_stellarmodel::mappings_stellarmodel(Preferences& p,
						   const nbody_data_grid& gr) :
  prefs(p), g(gr), axes(4), middle_axes(4),
  use_teff(prefs.defined("use_teff") && prefs.getValue("use_teff", bool()))
{
  using namespace boost::lambda;

  FITS input_file("/home/patrik/mappings/Zmodels.fits", Read );
  Array< T_float, 4 > temp;
  read (input_file.pHDU(), temp);
  // to get in increasing wavelength order
  temp.reverseSelf(fourthDim);
  // and transpose (z, t, 0/1, l) to get axes to be (0/1, t, Z, l)
  temp.transposeSelf(thirdDim, secondDim, firstDim, fourthDim);
  int crapass = 4;
  ExtHDU& axes_HDU = open_HDU (input_file, 1);

The details are not important, but as you can see, p and gr are
parameters, and input_file, temp, and crapass are local variables.

When I stop gdb on the final line, I can do this:

352       int crapass = 4;
(gdb)
353       ExtHDU& axes_HDU = open_HDU (input_file, 1);
(gdb) p crapass
No symbol "crapass" in current context.
(gdb) info scope 353
Scope for 353:
Symbol this is a variable with complex or multiple locations (DWARF2),
length 8.
Symbol p is a variable with complex or multiple locations (DWARF2),
length 8.
Symbol gr is a variable with complex or multiple locations (DWARF2),
length 8.

As you can see, only the this pointer and the parameters to the
constructor are recognized, it's as if the local variables don't exist.
 They are there, I can step into the calls to their member functions and
examine them, but they are missing from the gdb symbol table. If I step
up to the overlying stack frames, I can see those variables fine.

Does anyone have any idea what could be causing this and how to fix it?

thanks,

/Patrik J.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/gdb/attachments/20070518/210cef73/attachment.sig>


More information about the Gdb mailing list