I have C code which uses math functions for which I need to include math.h
(my box is i686-pc-linux-gnu). In ddd, if I type "print exp(-1.23)" into the
gdb console, i expect (and desire) to see the value 0.292293... printed out.
Instead, i see:
(gdb) print exp(-1.23)
$28 = 1
How does one make ddd (gdb) evaluate and print the value of expressions
(like exp(-1.23)) involving math functions?
Grr. I was afraid of that. Let me see if I can find a similarly
configured system to do some testing and make some suggestions.
--Maniac
Hello Ignorant-ga,
Odd. When I used a sample program that had #include , set a
breakpoint in the main program, and got the following results:
(gdb) print exp(-1.23)
Unable to call function at 0x90041320: no return type information available.
To call this function anyway, you can cast the return type explicitly
(e.g. 'print (float) fabs (3.0)')
(gdb)
No source file named 0x90041320.
(gdb) print (float) exp(-1.23)
$1 = 0.292292565
(gdb)
So, on my system - gdb knows where exp is defined but does not have
sufficient information for the function call. When you use the
suggested syntax - it does work OK.
In case its a version problem, on my system, I have
gcc 3.3
gdb 5.3
ddd 3.3.7
Please try the syntax above - if it works, indicate so I can prepare a
proper answer. If not, let me know what OS, gcc, and gdb versions you
are using so I can suggest a better answer.
--Maniac How do I Use a Debugger on the HPC Machines?:: If you learn gdb (or ddd) you can use them on almost any linux based system. The description here is of using the gdb (or ddd debugger) used on a VCL node. http://www.ncsu.edu/itd/hpc/Documents/debug.phpHOME |
Hello Ignorant-ga,
I checked on a couple linux systems:
Fedora Core 2
Red Hat Linux 7.3
and reproduced the symptom on both. I also checked the gdb bug list -
nothing there that looked relevant. I have a query in to Red Hat to
see if they are aware of the problem / can provide an updated gdb. I
will get back if I hear anything.
--Maniac [Tinyos-help] Manually breaking Tmote sky execution using msp430-gdb:: Hi, Im using MSP430FET UIF (USB interface) Im also using DDD in cygwin. I am > therefore running gdb and ddd in Linux (VMWare) and connecting to the > http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-July/018006.htmlHOME |
Typecasting does not help...
gcc 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
gdb GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
ddd GNU DDD 3.3.8 (i686-pc-linux-gnu)
Nortel Unveils Vision, Strategy for Israeli High-Performance Net
Busy Friday Leads to Strong Close for Net Stocks |