I'm writing/debugging an iPhone project that uses a large portion of C++ for image processing. I'm having trouble when I'm using gdb under Xcode because whenever I print values, they are completely out of whack with the true values (comparing
cout << "width" << width << endl;
prints out 320, and if I do a
in gdb, I get values like 805300460)
print width
I'm guessing it's a problem with gdb, not with the program, since I don't think I'm overwriting memory and values printed to stdout seem correct. The language is auto-set to be C++.
Looking at this Apple GDB doc it seems like adding this compiler flag might help -gdwarf-2? Not sure where to do so.
Anybody run into this problem? Have any ideas?