Some tweaks and fixes
This commit is contained in:
parent
49c86921ce
commit
0084de0f05
@ -20,7 +20,8 @@ namespace libdl {
|
|||||||
nullable<std::uint32_t>::null(),
|
nullable<std::uint32_t>::null(),
|
||||||
nullable<std::uint32_t>::null(),
|
nullable<std::uint32_t>::null(),
|
||||||
info.dli_fname ? info.dli_fname : "",
|
info.dli_fname ? info.dli_fname : "",
|
||||||
info.dli_sname ? info.dli_sname : ""
|
info.dli_sname ? info.dli_sname : "",
|
||||||
|
false
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
@ -28,7 +29,8 @@ namespace libdl {
|
|||||||
nullable<std::uint32_t>::null(),
|
nullable<std::uint32_t>::null(),
|
||||||
nullable<std::uint32_t>::null(),
|
nullable<std::uint32_t>::null(),
|
||||||
"",
|
"",
|
||||||
""
|
"",
|
||||||
|
false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include "../platform/utils.hpp"
|
#include "../platform/utils.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <climits>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -15,8 +16,9 @@ namespace detail {
|
|||||||
CPPTRACE_FORCE_NO_INLINE
|
CPPTRACE_FORCE_NO_INLINE
|
||||||
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
||||||
skip++;
|
skip++;
|
||||||
std::vector<void*> addrs(std::min(hard_max_frames, skip + max_depth), nullptr);
|
std::vector<void*> addrs(skip + std::min(hard_max_frames, max_depth), nullptr);
|
||||||
const int n_frames = backtrace(addrs.data(), static_cast<int>(addrs.size())); // thread safe
|
// thread safe
|
||||||
|
const int n_frames = backtrace(addrs.data(), static_cast<int>(addrs.size()));
|
||||||
// I hate the copy here but it's the only way that isn't UB
|
// I hate the copy here but it's the only way that isn't UB
|
||||||
std::vector<frame_ptr> frames(n_frames - skip, 0);
|
std::vector<frame_ptr> frames(n_frames - skip, 0);
|
||||||
for(int i = skip; i < n_frames; i++) {
|
for(int i = skip; i < n_frames; i++) {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ namespace detail {
|
|||||||
|
|
||||||
CPPTRACE_FORCE_NO_INLINE
|
CPPTRACE_FORCE_NO_INLINE
|
||||||
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
||||||
std::vector<frame_ptr> frames(std::min(hard_max_frames, max_depth), 0);
|
std::vector<frame_ptr> frames(skip + std::min(hard_max_frames, max_depth), 0);
|
||||||
unwind_state state{skip + 1, 0, frames};
|
unwind_state state{skip + 1, 0, frames};
|
||||||
_Unwind_Backtrace(unwind_callback, &state); // presumably thread-safe
|
_Unwind_Backtrace(unwind_callback, &state); // presumably thread-safe
|
||||||
frames.resize(state.count);
|
frames.resize(state.count);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ namespace cpptrace {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
CPPTRACE_FORCE_NO_INLINE
|
CPPTRACE_FORCE_NO_INLINE
|
||||||
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
std::vector<frame_ptr> capture_frames(std::size_t skip, std::size_t max_depth) {
|
||||||
std::vector<void*> addrs(std::min(hard_max_frames, max_depth), nullptr);
|
std::vector<void*> addrs(skip + std::min(hard_max_frames, max_depth), nullptr);
|
||||||
int n_frames = CaptureStackBackTrace(
|
int n_frames = CaptureStackBackTrace(
|
||||||
static_cast<ULONG>(skip + 1),
|
static_cast<ULONG>(skip + 1),
|
||||||
static_cast<ULONG>(addrs.size()),
|
static_cast<ULONG>(addrs.size()),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user