ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Breakpoint in ROS_ASSERT

asked 2014-07-07 05:19:34 -0500

Wolf gravatar image

Is it possible to set a debug breakpoint in ROS_ASSERT (gdb, Eclipse..) which only stops the program execution if the assertion fails so I can inspect the stack when the assertion fails?

It would work, if it would be like this:

if ( !( cond ) )
{
 ROS_ASSERT( cond );  // set breakpoint here
}

But without the surrounding if statement, the ROS_ASSERT is only in one line, and if I set a breakpoint there it will stop always, not only if the assertion fails.....

Any ideas on this? Thank you!

edit retag flag offensive close merge delete

Comments

1

ROS_ASSERT calls abort(). You might be able to trap that directly.

dornhege gravatar image dornhege  ( 2014-07-07 05:24:17 -0500 )edit

+1 Works! Thank you!

Wolf gravatar image Wolf  ( 2014-07-07 07:09:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-08 02:14:36 -0500

Wolf gravatar image

As @dornhege stated ROS_ASSERT calls abort. The SIGABRT can be trapped directly using gdb (in my case it even did by default;) ). Note that the thereby the SIGABRT is handled, so the process 'survives' the ROS_ASSERT. You still need to kill it via gbd....

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-07-07 05:19:34 -0500

Seen: 371 times

Last updated: Jul 08 '14