Remove full tracing options
This commit is contained in:
parent
f020265e09
commit
640aeadf91
@ -24,9 +24,6 @@ endif()
|
|||||||
|
|
||||||
option(CPPTRACE_STATIC "" OFF)
|
option(CPPTRACE_STATIC "" OFF)
|
||||||
|
|
||||||
option(CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE "" OFF)
|
|
||||||
option(CPPTRACE_FULL_TRACE_WITH_STACKTRACE "" OFF)
|
|
||||||
|
|
||||||
option(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE "" OFF)
|
option(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE "" OFF)
|
||||||
option(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF "" OFF)
|
option(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF "" OFF)
|
||||||
option(CPPTRACE_GET_SYMBOLS_WITH_LIBDL "" OFF)
|
option(CPPTRACE_GET_SYMBOLS_WITH_LIBDL "" OFF)
|
||||||
@ -119,11 +116,9 @@ if(MINGW OR NOT WIN32) # No need to bother checking in msvc, but do check in min
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# =============================================== Autoconfig unwinding ===============================================
|
# =============================================== Autoconfig unwinding ===============================================
|
||||||
# Unwind back-ends (If not doing CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE)
|
# Unwind back-ends
|
||||||
if(
|
if(
|
||||||
NOT (
|
NOT (
|
||||||
CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE OR
|
|
||||||
CPPTRACE_FULL_TRACE_WITH_STACKTRACE OR
|
|
||||||
CPPTRACE_UNWIND_WITH_UNWIND OR
|
CPPTRACE_UNWIND_WITH_UNWIND OR
|
||||||
CPPTRACE_UNWIND_WITH_EXECINFO OR
|
CPPTRACE_UNWIND_WITH_EXECINFO OR
|
||||||
CPPTRACE_UNWIND_WITH_WINAPI OR
|
CPPTRACE_UNWIND_WITH_WINAPI OR
|
||||||
@ -164,8 +159,6 @@ endif()
|
|||||||
# =============================================== Autoconfig symbols ===============================================
|
# =============================================== Autoconfig symbols ===============================================
|
||||||
if(
|
if(
|
||||||
NOT (
|
NOT (
|
||||||
CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE OR
|
|
||||||
CPPTRACE_FULL_TRACE_WITH_STACKTRACE OR
|
|
||||||
CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE OR
|
CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE OR
|
||||||
CPPTRACE_GET_SYMBOLS_WITH_LIBDL OR
|
CPPTRACE_GET_SYMBOLS_WITH_LIBDL OR
|
||||||
CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE OR
|
CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE OR
|
||||||
@ -217,8 +210,6 @@ set(
|
|||||||
src/cpptrace.cpp
|
src/cpptrace.cpp
|
||||||
src/demangle/demangle_with_cxxabi.cpp
|
src/demangle/demangle_with_cxxabi.cpp
|
||||||
src/demangle/demangle_with_nothing.cpp
|
src/demangle/demangle_with_nothing.cpp
|
||||||
src/full/full_trace_with_libbacktrace.cpp
|
|
||||||
src/full/full_trace_with_stacktrace.cpp
|
|
||||||
src/symbols/symbols_with_addr2line.cpp
|
src/symbols/symbols_with_addr2line.cpp
|
||||||
src/symbols/symbols_with_dbghelp.cpp
|
src/symbols/symbols_with_dbghelp.cpp
|
||||||
src/symbols/symbols_with_dl.cpp
|
src/symbols/symbols_with_dl.cpp
|
||||||
@ -276,21 +267,6 @@ function(check_backtrace_error)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Full
|
|
||||||
if(CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE)
|
|
||||||
check_backtrace_error()
|
|
||||||
target_compile_definitions(cpptrace PUBLIC CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE)
|
|
||||||
target_link_libraries(cpptrace PRIVATE backtrace)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CPPTRACE_FULL_TRACE_WITH_STACKTRACE)
|
|
||||||
if(NOT HAS_STACKTRACE)
|
|
||||||
message(WARNING "Cpptrace: CPPTRACE_FULL_TRACE_WITH_STACKTRACE specified but <stacktrace> doesn't seem to be available.")
|
|
||||||
endif()
|
|
||||||
target_compile_definitions(cpptrace PUBLIC CPPTRACE_FULL_TRACE_WITH_STACKTRACE)
|
|
||||||
target_link_libraries(cpptrace PRIVATE "${STACKTRACE_LINK_LIB}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Symbols
|
# Symbols
|
||||||
if(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE)
|
if(CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE)
|
||||||
check_backtrace_error()
|
check_backtrace_error()
|
||||||
|
|||||||
14
README.md
14
README.md
@ -294,23 +294,13 @@ search the system path for `addr2line` at runtime. This is not the default to pr
|
|||||||
|
|
||||||
**Demangling**
|
**Demangling**
|
||||||
|
|
||||||
Lastly, depending on other back-ends used a demangler back-end may be needed. A demangler back-end is not needed when
|
Lastly, depending on other back-ends used a demangler back-end may be needed.
|
||||||
doing full traces with libbacktrace, getting symbols with addr2line, or getting symbols with dbghelp.
|
|
||||||
|
|
||||||
| Library | CMake config | Platforms | Info |
|
| Library | CMake config | Platforms | Info |
|
||||||
| -------- | -------------------------------- | ------------------- | ---------------------------------------------------------------------------------- |
|
| -------- | -------------------------------- | ------------------- | ---------------------------------------------------------------------------------- |
|
||||||
| cxxabi.h | `CPPTRACE_DEMANGLE_WITH_CXXABI` | Linux, macos, mingw | Should be available everywhere other than [msvc](https://godbolt.org/z/93ca9rcdz). |
|
| cxxabi.h | `CPPTRACE_DEMANGLE_WITH_CXXABI` | Linux, macos, mingw | Should be available everywhere other than [msvc](https://godbolt.org/z/93ca9rcdz). |
|
||||||
| N/A | `CPPTRACE_DEMANGLE_WITH_NOTHING` | all | Don't attempt to do anything beyond what the symbol resolution back-end does. |
|
| N/A | `CPPTRACE_DEMANGLE_WITH_NOTHING` | all | Don't attempt to do anything beyond what the symbol resolution back-end does. |
|
||||||
|
|
||||||
**Full tracing**
|
|
||||||
|
|
||||||
Libbacktrace can generate a full stack trace itself, both unwinding and resolving symbols. This can be chosen with
|
|
||||||
`CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE`. The auto config attempts to use this if it is available. Full tracing with
|
|
||||||
libbacktrace ignores `CPPTRACE_HARD_MAX_FRAMES`.
|
|
||||||
|
|
||||||
`<stacktrace>` can of course also generate a full trace, if you're using >=C++23 and your compiler supports it. This is
|
|
||||||
controlled by `CPPTRACE_FULL_TRACE_WITH_STACKTRACE`. `CPPTRACE_HARD_MAX_FRAMES` is ignored.
|
|
||||||
|
|
||||||
**More?**
|
**More?**
|
||||||
|
|
||||||
There are plenty more libraries that can be used for unwinding, parsing debug information, and demangling. In the future
|
There are plenty more libraries that can be used for unwinding, parsing debug information, and demangling. In the future
|
||||||
@ -321,8 +311,6 @@ more back-ends can be added. Ideally this library can "just work" on systems, wi
|
|||||||
Summary of all library configuration options:
|
Summary of all library configuration options:
|
||||||
|
|
||||||
Back-ends:
|
Back-ends:
|
||||||
- `CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE=On/Off`
|
|
||||||
- `CPPTRACE_FULL_TRACE_WITH_STACKTRACE=On/Off`
|
|
||||||
- `CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On/Off`
|
- `CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On/Off`
|
||||||
- `CPPTRACE_GET_SYMBOLS_WITH_DBGHELP=On/Off`
|
- `CPPTRACE_GET_SYMBOLS_WITH_DBGHELP=On/Off`
|
||||||
- `CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE=On/Off`
|
- `CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE=On/Off`
|
||||||
|
|||||||
@ -163,7 +163,7 @@ def main():
|
|||||||
"compiler": ["g++-10", "clang++-14"],
|
"compiler": ["g++-10", "clang++-14"],
|
||||||
"target": ["Debug"],
|
"target": ["Debug"],
|
||||||
"std": ["11", "20"],
|
"std": ["11", "20"],
|
||||||
"config": ["-DCPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE=On", ""]
|
"config": [""]
|
||||||
}
|
}
|
||||||
exclude = []
|
exclude = []
|
||||||
run_matrix(matrix, exclude, build_full_or_auto)
|
run_matrix(matrix, exclude, build_full_or_auto)
|
||||||
@ -283,11 +283,7 @@ def main():
|
|||||||
"std": ["11", "20"],
|
"std": ["11", "20"],
|
||||||
"config": [""]
|
"config": [""]
|
||||||
}
|
}
|
||||||
exclude = [
|
exclude = []
|
||||||
{
|
|
||||||
"config": "-DCPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE=On"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
run_matrix(matrix, exclude, build_full_or_auto)
|
run_matrix(matrix, exclude, build_full_or_auto)
|
||||||
|
|
||||||
global failed
|
global failed
|
||||||
|
|||||||
@ -81,10 +81,6 @@ def output_matches(output: str, params: Tuple[str]):
|
|||||||
max_line_diff = MAX_LINE_DIFF
|
max_line_diff = MAX_LINE_DIFF
|
||||||
if "CPPTRACE_UNWIND_WITH_UNWIND" in params:
|
if "CPPTRACE_UNWIND_WITH_UNWIND" in params:
|
||||||
max_line_diff = 0
|
max_line_diff = 0
|
||||||
if "CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE" in params:
|
|
||||||
max_line_diff = 0
|
|
||||||
if "CPPTRACE_FULL_TRACE_WITH_STACKTRACE" in params:
|
|
||||||
max_line_diff = 0
|
|
||||||
|
|
||||||
errored = False
|
errored = False
|
||||||
|
|
||||||
@ -321,7 +317,7 @@ def main():
|
|||||||
"compiler": ["g++-10", "clang++-14"],
|
"compiler": ["g++-10", "clang++-14"],
|
||||||
"target": ["Debug"],
|
"target": ["Debug"],
|
||||||
"std": ["11", "20"],
|
"std": ["11", "20"],
|
||||||
"config": ["-DCPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE=On", ""]
|
"config": [""]
|
||||||
}
|
}
|
||||||
exclude = []
|
exclude = []
|
||||||
run_matrix(matrix, exclude, build_and_test_full_or_auto)
|
run_matrix(matrix, exclude, build_and_test_full_or_auto)
|
||||||
@ -441,11 +437,7 @@ def main():
|
|||||||
"std": ["11", "20"],
|
"std": ["11", "20"],
|
||||||
"config": [""]
|
"config": [""]
|
||||||
}
|
}
|
||||||
exclude = [
|
exclude = []
|
||||||
{
|
|
||||||
"config": "-DCPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE=On"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
run_matrix(matrix, exclude, build_and_test_full_or_auto)
|
run_matrix(matrix, exclude, build_and_test_full_or_auto)
|
||||||
|
|
||||||
global failed
|
global failed
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
#ifdef CPPTRACE_BACKTRACE_PATH
|
|
||||||
#include CPPTRACE_BACKTRACE_PATH
|
|
||||||
#else
|
|
||||||
#include <backtrace.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
backtrace_state* state = backtrace_create_state(nullptr, true, nullptr, nullptr);
|
|
||||||
}
|
|
||||||
2
lint.sh
2
lint.sh
@ -4,7 +4,7 @@ status=0
|
|||||||
while read f
|
while read f
|
||||||
do
|
do
|
||||||
echo checking $f
|
echo checking $f
|
||||||
flags="-DCPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE -DCPPTRACE_FULL_TRACE_WITH_STACKTRACE -DCPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE -DCPPTRACE_GET_SYMBOLS_WITH_LIBDL -DCPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE -DCPPTRACE_GET_SYMBOLS_WITH_NOTHING -DCPPTRACE_UNWIND_WITH_EXECINFO -DCPPTRACE_UNWIND_WITH_UNWIND -DCPPTRACE_UNWIND_WITH_NOTHING -DCPPTRACE_DEMANGLE_WITH_CXXABI -DCPPTRACE_DEMANGLE_WITH_NOTHING -DCPPTRACE_ADDR2LINE_SEARCH_SYSTEM_PATH"
|
flags="-DCPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE -DCPPTRACE_GET_SYMBOLS_WITH_LIBDL -DCPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE -DCPPTRACE_GET_SYMBOLS_WITH_NOTHING -DCPPTRACE_UNWIND_WITH_EXECINFO -DCPPTRACE_UNWIND_WITH_UNWIND -DCPPTRACE_UNWIND_WITH_NOTHING -DCPPTRACE_DEMANGLE_WITH_CXXABI -DCPPTRACE_DEMANGLE_WITH_NOTHING -DCPPTRACE_ADDR2LINE_SEARCH_SYSTEM_PATH"
|
||||||
clang-tidy $f -- -std=c++11 -Iinclude $@ $flags
|
clang-tidy $f -- -std=c++11 -Iinclude $@ $flags
|
||||||
ret=$?
|
ret=$?
|
||||||
if [ $ret -ne 0 ]; then
|
if [ $ret -ne 0 ]; then
|
||||||
|
|||||||
@ -7,46 +7,12 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if !(defined(CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE) || defined(CPPTRACE_FULL_TRACE_WITH_STACKTRACE))
|
|
||||||
|
|
||||||
#include "symbols/symbols.hpp"
|
#include "symbols/symbols.hpp"
|
||||||
#include "unwind/unwind.hpp"
|
#include "unwind/unwind.hpp"
|
||||||
#include "demangle/demangle.hpp"
|
#include "demangle/demangle.hpp"
|
||||||
#include "platform/common.hpp"
|
#include "platform/common.hpp"
|
||||||
#include "platform/utils.hpp"
|
#include "platform/utils.hpp"
|
||||||
|
|
||||||
namespace cpptrace {
|
|
||||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
|
||||||
std::vector<stacktrace_frame> generate_trace(std::uint32_t skip) {
|
|
||||||
std::vector<void*> frames = detail::capture_frames(skip + 1);
|
|
||||||
std::vector<stacktrace_frame> trace = detail::resolve_frames(frames);
|
|
||||||
for(auto& frame : trace) {
|
|
||||||
frame.symbol = detail::demangle(frame.symbol);
|
|
||||||
}
|
|
||||||
return trace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// full trace
|
|
||||||
|
|
||||||
#include "full/full_trace.hpp"
|
|
||||||
#include "demangle/demangle.hpp"
|
|
||||||
|
|
||||||
namespace cpptrace {
|
|
||||||
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
|
||||||
std::vector<stacktrace_frame> generate_trace(std::uint32_t skip) {
|
|
||||||
auto trace = detail::generate_trace(skip + 1);
|
|
||||||
for(auto& entry : trace) {
|
|
||||||
entry.symbol = detail::demangle(entry.symbol);
|
|
||||||
}
|
|
||||||
return trace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ESC "\033["
|
#define ESC "\033["
|
||||||
#define RESET ESC "0m"
|
#define RESET ESC "0m"
|
||||||
#define RED ESC "31m"
|
#define RED ESC "31m"
|
||||||
@ -57,6 +23,16 @@ namespace cpptrace {
|
|||||||
#define CYAN ESC "36m"
|
#define CYAN ESC "36m"
|
||||||
|
|
||||||
namespace cpptrace {
|
namespace cpptrace {
|
||||||
|
CPPTRACE_FORCE_NO_INLINE CPPTRACE_API
|
||||||
|
std::vector<stacktrace_frame> generate_trace(std::uint32_t skip) {
|
||||||
|
std::vector<void*> frames = detail::capture_frames(skip + 1);
|
||||||
|
std::vector<stacktrace_frame> trace = detail::resolve_frames(frames);
|
||||||
|
for(auto& frame : trace) {
|
||||||
|
frame.symbol = detail::demangle(frame.symbol);
|
||||||
|
}
|
||||||
|
return trace;
|
||||||
|
}
|
||||||
|
|
||||||
CPPTRACE_API
|
CPPTRACE_API
|
||||||
void print_trace(std::uint32_t skip) {
|
void print_trace(std::uint32_t skip) {
|
||||||
detail::enable_virtual_terminal_processing_if_needed();
|
detail::enable_virtual_terminal_processing_if_needed();
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
#ifndef FULL_TRACE_HPP
|
|
||||||
#define FULL_TRACE_HPP
|
|
||||||
|
|
||||||
#include <cpptrace/cpptrace.hpp>
|
|
||||||
#include "../platform/common.hpp"
|
|
||||||
#include "../platform/utils.hpp"
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace cpptrace {
|
|
||||||
namespace detail {
|
|
||||||
CPPTRACE_FORCE_NO_INLINE
|
|
||||||
std::vector<stacktrace_frame> generate_trace(size_t skip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
#ifdef CPPTRACE_FULL_TRACE_WITH_LIBBACKTRACE
|
|
||||||
|
|
||||||
#include <cpptrace/cpptrace.hpp>
|
|
||||||
#include "../platform/program_name.hpp"
|
|
||||||
#include "../platform/common.hpp"
|
|
||||||
#include "../platform/utils.hpp"
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <mutex>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#ifdef CPPTRACE_BACKTRACE_PATH
|
|
||||||
#include CPPTRACE_BACKTRACE_PATH
|
|
||||||
#else
|
|
||||||
#include <backtrace.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace cpptrace {
|
|
||||||
namespace detail {
|
|
||||||
struct trace_data {
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
|
|
||||||
std::vector<stacktrace_frame>& frames;
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
|
|
||||||
size_t& skip;
|
|
||||||
};
|
|
||||||
|
|
||||||
int full_callback(void* data_pointer, uintptr_t address, const char* file, int line, const char* symbol) {
|
|
||||||
trace_data& data = *reinterpret_cast<trace_data*>(data_pointer);
|
|
||||||
if(data.skip > 0) {
|
|
||||||
data.skip--;
|
|
||||||
} else if(address == uintptr_t(-1)) {
|
|
||||||
// sentinel for libbacktrace, stop tracing
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
data.frames.push_back({
|
|
||||||
address,
|
|
||||||
static_cast<std::uint_least32_t>(line),
|
|
||||||
0,
|
|
||||||
file ? file : "",
|
|
||||||
symbol ? symbol : ""
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void syminfo_callback(void* data, uintptr_t, const char* symbol, uintptr_t, uintptr_t) {
|
|
||||||
stacktrace_frame& frame = *static_cast<stacktrace_frame*>(data);
|
|
||||||
frame.symbol = symbol ? symbol : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void error_callback(void*, const char* msg, int errnum) {
|
|
||||||
nonfatal_error(stringf("libbacktrace error: %s, code %d", msg, errnum));
|
|
||||||
}
|
|
||||||
|
|
||||||
backtrace_state* get_backtrace_state() {
|
|
||||||
static std::mutex mutex;
|
|
||||||
const std::lock_guard<std::mutex> lock(mutex);
|
|
||||||
// backtrace_create_state must be called only one time per program
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
|
||||||
static backtrace_state* state = nullptr;
|
|
||||||
static bool called = false;
|
|
||||||
if(!called) {
|
|
||||||
state = backtrace_create_state(nullptr, true, error_callback, nullptr);
|
|
||||||
called = true;
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPPTRACE_FORCE_NO_INLINE
|
|
||||||
std::vector<stacktrace_frame> generate_trace(size_t skip) {
|
|
||||||
std::vector<stacktrace_frame> frames;
|
|
||||||
skip++; // add one for this call
|
|
||||||
trace_data data { frames, skip };
|
|
||||||
backtrace_full(get_backtrace_state(), 0, full_callback, error_callback, &data);
|
|
||||||
for(auto& frame : frames) {
|
|
||||||
if(frame.symbol.empty()) {
|
|
||||||
// fallback, try to at least recover the symbol name with backtrace_syminfo
|
|
||||||
backtrace_syminfo(
|
|
||||||
get_backtrace_state(),
|
|
||||||
frame.address,
|
|
||||||
syminfo_callback,
|
|
||||||
error_callback,
|
|
||||||
&frame
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return frames;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
#ifdef CPPTRACE_FULL_TRACE_WITH_STACKTRACE
|
|
||||||
|
|
||||||
#include <cpptrace/cpptrace.hpp>
|
|
||||||
#include "full_trace.hpp"
|
|
||||||
#include "../platform/common.hpp"
|
|
||||||
#include "../platform/utils.hpp"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <stacktrace>
|
|
||||||
|
|
||||||
namespace cpptrace {
|
|
||||||
namespace detail {
|
|
||||||
CPPTRACE_FORCE_NO_INLINE
|
|
||||||
std::vector<stacktrace_frame> generate_trace(size_t skip) {
|
|
||||||
std::vector<stacktrace_frame> frames;
|
|
||||||
std::stacktrace trace = std::stacktrace::current(skip + 1);
|
|
||||||
for(const auto entry : trace) {
|
|
||||||
frames.push_back({
|
|
||||||
entry.native_handle(),
|
|
||||||
entry.source_line(),
|
|
||||||
0,
|
|
||||||
entry.source_file(),
|
|
||||||
entry.description()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return frames;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loading…
Reference in New Issue
Block a user