LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2004, 05:56 PM   #1
vose
Member
 
Registered: Aug 2002
Location: tennessee
Distribution: gentoo
Posts: 39

Rep: Reputation: 15
gdb


I have a C program which uses the math library (gcc ... -lm), and I can
run ddd on it fine, EXCEPT that inorder to debug, I would like to
evaluate expressions which contain math functions (like exp, log, etc.)
and there is the problem; gdb refuses to properly evaluate math functions:

(gdb) print exp(12.234)
$21 = 1

What magic is required in order that gdb will evaluate math expressions?

NOTE: I do not want to step through the math functions, I just want gdb
to print their correct value!!!
 
Old 07-18-2004, 12:08 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Tribblix, Ubuntu/WSL
Posts: 9,767

Rep: Reputation: 467Reputation: 467Reputation: 467Reputation: 467Reputation: 467
try
Code:
print printf("%f\n",exp(12.234))
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gdb sabeel Programming 2 03-26-2007 08:58 PM
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 05:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 02:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 04:02 AM
How to use GDB ? indian Programming 4 09-06-2004 06:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration