Strange behavior in gdb 5.3 on suse linux

Strange behavior in gdb 5.3 on suse linux

Post by smatt » Fri, 01 Oct 2004 08:58:24


Running gdb version 5.3 on Suse Linux.
I am using g++ version 3.2.2
I am specifing compiler swithces -g and have also tried -ggdb for more
debugging information.

Lots of weird behavior when running gdb to check data. Here is a small
example of the problem that I am having.
I am unable to print the value of variable i in the code below.

When stepping into a block of code like this:
(gdb) list
40 int matsize = strike_.size() * tau_.size();
41 for( int i = 0; i < (strike_.size() * tau_.size()); i++ )
42 {
43 cout << i << endl;
44 position_.push_back(100);
45 }
(gdb) where 1
#0 PAAParams (this=0xbffff110) at PAAParams.cpp:44
(More stack frames follow...)
(gdb) print i
No symbol "i" in current context.
(gdb) print strike_.size() * tau_.size()
$1 = 84

Note that I am on line 41 and still cannot print variable i inside the
for loop !!! I am expecting the value of i to be 0<= i <= 84.
The variable does get printed to cout with values upto 84 !

At the end of the loop, vector's size i.e. position_.size() == 84 !
which is correct. Therefore I do know that the code is being executed.

I also am not able to step into some parts of my code, also compiled
with the same debug switches.

Are there any more compile swithes that I should be setting ? I have
always used -g for generating debug and symbol tables.

What could be causing this problem ?

Sunil
 
 
 

Strange behavior in gdb 5.3 on suse linux

Post by Lawrence D » Mon, 04 Oct 2004 17:47:10

In article < XXXX@XXXXX.COM >,



What optimization settings are you using? That's one thing virtually
guaranteed to confuse a de *** .

 
 
 

Strange behavior in gdb 5.3 on suse linux

Post by smatt » Wed, 06 Oct 2004 10:37:58


True. As I had indicated, I tried -g and -ggdb switches only. No
optimization levels whatsoever being set.

Today, I got a message that looked like "dwarf cfa error...."
Never sas this stuff on Solaris.

Plus the fact that I cannot call any math functions from within gdb
eg.
print sqrt(9.0) results in -1.4978... this includes log and other math
functions as well. They work in the program, just not in gdb.

Does anyone at SuSE/Novell have any ideas ???

Sunil
 
 
 

Strange behavior in gdb 5.3 on suse linux

Post by ptb » Wed, 06 Oct 2004 19:51:15


sqrt requires a double arg. And returns one. Make it so.

Peter