Quantcast
Channel: The Fugue » cs
Viewing all articles
Browse latest Browse all 10

SIGABRT and gdb

$
0
0

So you fire up gdb and pepper your code with assert() calls. Then one of your assertions fails and you see this:

Assertion failed: (item_idx < si.slabclass[clsid].perslab), function ITEM, file slabs_items.h, line 78.
Program received signal SIGABRT, Aborted.
0x00007fff83efab16 in kevent ()
(gdb)

Well shucks, you think you're screwed because gdb doesn't seem to have left you in a useful state. So you investigate conditional breakpoints (that are a pain to set and don't seem want to work in inline functions), and generally beat yourself over the head for awhile.

Then you realize that gdb's throwing you out into a different thread, and your pretty backtrace is there for the exploring, you just have to switch to the right thread. Yeah, remember that. Then maybe you can set a breakpoint on the actual assert code (which you can find with the backtrace—it was __assert_rtn() in my case) so you're already in the right thread and just need to go up the backtrace one level to get to debugging goodness.


Viewing all articles
Browse latest Browse all 10

Trending Articles