I wonder why evaluate function doesn’t work in gdb? In my source file I include, when debugging in gdb, these examples are wrong evaluations.
(gdb) p pow(3,2)
$10 = 1
(gdb) p pow(3,3)
$11 = 1
(gdb) p sqrt(9)
$12 = 0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My guess is that the compiler and linker does some magic with those particular functions. Most likely to increase performance.
If you absolutely need
pow()to be available in gdb then you can create your own wrapper function:Maybe also wrap it into a
#ifdef DEBUGor something to not clutter the final binary.BTW, you will notice that other library functions can be called (and their return value printed), for instance: