mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
[ras] add backward-cpp
This commit is contained in:
parent
edfd835866
commit
399cf83fc5
@ -1,6 +1,6 @@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Thu Apr 29 09:08:09 PDT 2021
|
||||
# from AX_AM_MACROS_STATIC on Sun May 23 13:53:53 PDT 2021
|
||||
|
||||
|
||||
# Code coverage
|
||||
|
@ -1,4 +1,17 @@
|
||||
#! /bin/sh
|
||||
|
||||
sudo apk update && sudo apk upgrade
|
||||
sudo apk add build-base m4 git zip perl ncurses autoconf automake libtool linux-headers
|
||||
sudo apk add \
|
||||
build-base \
|
||||
binutils \
|
||||
m4 \
|
||||
git \
|
||||
zip \
|
||||
perl \
|
||||
ncurses \
|
||||
autoconf \
|
||||
automake \
|
||||
libexecinfo-dev \
|
||||
libexecinfo-static \
|
||||
libtool \
|
||||
linux-headers
|
||||
|
@ -496,6 +496,7 @@ target_include_directories(
|
||||
.
|
||||
fmtlib
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
third-party
|
||||
)
|
||||
|
||||
target_link_libraries(diag
|
||||
|
@ -117,6 +117,7 @@ AM_CPPFLAGS = \
|
||||
-DSYSCONFDIR='"$(sysconfdir)"' \
|
||||
-DSQLITE_OMIT_LOAD_EXTENSION \
|
||||
-I$(srcdir)/fmtlib \
|
||||
-I$(srcdir)/third-party \
|
||||
-Wall \
|
||||
$(CODE_COVERAGE_CPPFLAGS) \
|
||||
$(LIBARCHIVE_CFLAGS) \
|
||||
|
@ -45,6 +45,7 @@ target_include_directories(
|
||||
.
|
||||
..
|
||||
../fmtlib
|
||||
../third-party
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
||||
target_link_libraries(base cppfmt PkgConfig::libpcre)
|
||||
|
@ -5,6 +5,7 @@ AM_CPPFLAGS = \
|
||||
$(CODE_COVERAGE_CPPFLAGS) \
|
||||
-Wall \
|
||||
-I$(top_srcdir)/src/ \
|
||||
-I$(top_srcdir)/src/third-party \
|
||||
-I$(top_srcdir)/src/fmtlib \
|
||||
$(LIBARCHIVE_CFLAGS) \
|
||||
$(READLINE_CFLAGS) \
|
||||
|
@ -47,6 +47,7 @@
|
||||
#ifdef HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include "backward-cpp/backward.hpp"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
@ -415,6 +416,27 @@ static void sigabrt(int sig)
|
||||
#ifdef HAVE_EXECINFO_H
|
||||
backtrace_symbols_fd(frames, frame_count, fd);
|
||||
#endif
|
||||
{
|
||||
backward::StackTrace st;
|
||||
|
||||
st.load_here(32);
|
||||
backward::TraceResolver tr;
|
||||
|
||||
tr.load_stacktrace(st);
|
||||
for (size_t lpc = 0; lpc < st.size(); lpc++) {
|
||||
auto trace = tr.resolve(st[lpc]);
|
||||
char buf[1024];
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Frame %lu:%s:%s (%s:%d)\n",
|
||||
lpc,
|
||||
trace.object_filename.c_str(),
|
||||
trace.object_function.c_str(),
|
||||
trace.source.filename.c_str(),
|
||||
trace.source.line);
|
||||
write(fd, buf, strlen(buf));
|
||||
}
|
||||
}
|
||||
log_ring.lr_length = 0;
|
||||
log_ring.lr_frag_start = BUFFER_SIZE;
|
||||
log_ring.lr_frag_end = 0;
|
||||
|
4457
src/third-party/backward-cpp/backward.hpp
vendored
Normal file
4457
src/third-party/backward-cpp/backward.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user