Revision 1255dcd4465b6578cf21a286cc512a2a84932d78 authored by Haobo Xu on 11 April 2013, 17:54:35 UTC, committed by Abhishek Kona on 20 April 2013, 17:26:50 UTC
Summary:
This diff provides the ability to print out a stacktrace when the process receives certain signals.
Currently, we enable this for the following signals (program error related):
SIGILL SIGSEGV SIGBUS SIGABRT
Application simply #include "util/stack_trace.h" and call leveldb::InstallStackTraceHandler() during initialization, if signal handler is needed. It's not done automatically when openning db, because it's the application(process)'s responsibility to install signal handler and some applications might already have their own (like fbcode).

Sample output:
Received signal 11 (Segmentation fault)
#0  0x408ff0 ./signal_test() [0x408ff0] /home/haobo/rocksdb/util/signal_test.cc:4
#1  0x40827d ./signal_test() [0x40827d] /home/haobo/rocksdb/util/signal_test.cc:24
#2  0x7f8bb183172e /usr/local/fbcode/gcc-4.7.1-glibc-2.14.1/lib/libc.so.6(__libc_start_main+0x10e) [0x7f8bb183172e] ??:0
#3  0x408ebc ./signal_test() [0x408ebc] /home/engshare/third-party/src/glibc/glibc-2.14.1/glibc-2.14.1/csu/../sysdeps/x86_64/elf/start.S:113
Segmentation fault (core dumped)

For each frame, we print the raw pointer, the symbol provided by backtrace_symbols (still not good enough), and the source file/line. Note that address translation is done by directly shell out to addr2line. ??:0 means addr2line fails to do the translation. Hacky, but I think it's good for now.

Test Plan: signal_test.cc

Reviewers: dhruba, MarkCallaghan

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D10173
1 parent a29fc17
History
File Mode Size
VALGRIND_LOGS
db
doc
hdfs
helpers
include
java
linters
port
scribe
snappy
table
thrift
tools
util
.arcconfig -rw-r--r-- 243 bytes
.gitignore -rw-r--r-- 174 bytes
LICENSE -rw-r--r-- 1.4 KB
Makefile -rw-r--r-- 10.8 KB
README -rw-r--r-- 2.2 KB
README.fb -rw-r--r-- 98 bytes
build_detect_platform -rwxr-xr-x 8.8 KB
build_detect_version -rwxr-xr-x 1.2 KB
build_java.sh -rwxr-xr-x 1.9 KB
e -rw-r--r-- 51 bytes
fbcode.clang31.sh -rw-r--r-- 3.1 KB
fbcode.gcc471.sh -rw-r--r-- 2.9 KB
regression_build_test.sh -rwxr-xr-x 2.3 KB
valgrind_test.sh -rwxr-xr-x 417 bytes

README

back to top