adds a backtrace & shows the line that caused a segfault of some native code
C Shell Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Small library which captures segmentation faults on native code, outputs the backtrace and the line that caused the fault which can compiled as a static library and used like this:

$ make
$ LD_PRELOAD=./ ./experiment # experiment is a small C program that segfaults

and it will output something like

========== The program crashed =========
==> context

==> offending sigsegv line
*faulty = 314;
==> stacktrace
./ [0x7f8e2e286bb6]
./ [0x7f8e2e286d9b]
/usr/lib/ [0x7f8e2df1b0b0]
./experiment() [0x4004b6]
/usr/lib/ [0x7f8e2df08291]
./experiment() [0x4003da]

Warning! I just made this for learning purposes, it's probably not safe to use and it's not portable either. Only tested in a Linux 4.9.11 box w/ GCC version 6.3.1 installed.