Skip to content

Debugger getting stuck on SIGTRAPs

Time to post about all the issues I had while using (or more precisely, while debugging inside) Code::Blocks during my latest internship. Today I’ll deal with that strange message that seemed to pop up randomly while debugging with GDB:

Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!TpWaitForAlpcCompletion () (C:\Windows\system32\ntdll.dll)

Of course, the message itself wouldn’t be much trouble, if it were not for the fact that it stops the debugger like a breakpoint with no way to resume (long story short: thus I couldn’t run the debugger until I reach my real breakpoints…).

I eventually managed to find some workaround: in the global debugger settings (Settings -> Compiler and debugger -> Debugger settings), enter the following in the Debugger initialization commands field:

handle SIGTRAP noprint nostop

This basically tells the debugger not to display SIGTRAP issues and, more importantly, not to stop on them. Note, however, that:

  1. The debugger will still be a bit slowed down: I noticed that it regularly briefly drops to 0% CPU usage before filling its core again. So I think every time it reaches a SIGTRAP it halts then carries on more or less immediately.
  2. When you get those SIGTRAPs it probably means there’s something wrong somewhere in your code. In my case indeed I had some naughty memory access violation (I’ll make a short post about it separately when I find the time)

Sources that helped:

Posted in programming.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA