Program received signal SIGTRAP, Trace/breakpoint trap

Randomblue picture Randomblue · Mar 21, 2012 · Viewed 82.4k times · Source

I'm debugging a piece of (embedded) software. I've set a breakpoint on a function, and for some reason, once I've reached that breakpoint and continue I always come back to the function (which is an initialisation function which should only be called once). When I remove the breakpoint, and continue, GDB tells me:

Program received signal SIGTRAP, Trace/breakpoint trap.

Since I was working with breakpoints, I'm assuming I fell in a "breakpoint trap". What is a breakpoint trap?

Answer

b1tchacked picture b1tchacked · May 15, 2015

The other possibility i can think of is:

1.Your process is running more than one thread.

For eg - 2 say x & y.

2.Thread y hits the break point but you have attached gdb to thread x.

This case is a Trace/breakpoint trap.