Ask Your Question
0

ros::Time.now().toSec() optimized out

asked 2014-10-29 01:14:11 -0500

Juan gravatar image

Dear all,

Using ROS Hydro on Ubuntu 12.04. I am trying to see the result of ros::Time.now().toSec() while debugging a node, but the debugger says the value is optimized out.

I know that normally we can change a CMake file to change the debug type of a binary, however, since this is part of ROS deb package, I am not sure how to go about it.

Any suggestions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-10-29 02:20:08 -0500

Wolf gravatar image

I assume you have something like:

double seconds = ros::Time.now().toSec();

Now you try to debug the value seconds? (Other: you can't debug into the functions now() or toSec() because the deb is - obviously correctly - build as release...; If you want to debug this you have to recompile it yourself from source in debug mode...)

Assuming you can't access the seconds value, it is because it is optimized out in your code (or your code is not even build with debug info). You can change this by setting the build type for catkin via command like like:

with debug info, with optimization:

catkin_make -DCMAKE_BUILD_TYPE=RelWithDebInfo

with debug info, without optimization:

catkin_make -DCMAKE_BUILD_TYPE=Debug
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-10-29 01:14:11 -0500

Seen: 412 times

Last updated: Oct 29 '14