Refactor nested namespaces
This commit is contained in:
parent
cc43a23987
commit
fdbc69e18e
@ -4,9 +4,9 @@
|
||||
#include <string>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
std::string demangle(const std::string&);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
std::string demangle(const std::string& name) {
|
||||
int status;
|
||||
// presumably thread-safe
|
||||
@ -26,7 +26,7 @@ namespace cpptrace {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
#include <string>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
std::string demangle(const std::string& name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,10 +9,10 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
std::vector<stacktrace_frame> generate_trace(size_t skip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#endif
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
struct trace_data {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
|
||||
std::vector<stacktrace_frame>& frames;
|
||||
@ -87,7 +87,7 @@ namespace cpptrace {
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,12 +3,13 @@
|
||||
#include <cpptrace/cpptrace.hpp>
|
||||
#include "full_trace.hpp"
|
||||
#include "../platform/common.hpp"
|
||||
#include "../platform/utils.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <stacktrace>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
std::vector<stacktrace_frame> generate_trace(size_t skip) {
|
||||
std::vector<stacktrace_frame> frames;
|
||||
@ -24,7 +25,7 @@ namespace cpptrace {
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
#ifdef CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE
|
||||
namespace libbacktrace {
|
||||
std::vector<stacktrace_frame> resolve_frames(const std::vector<void*>& frames);
|
||||
@ -39,7 +39,7 @@ namespace cpptrace {
|
||||
}
|
||||
#endif
|
||||
std::vector<stacktrace_frame> resolve_frames(const std::vector<void*>& frames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
#include "symbols.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "../platform/object.hpp"
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
void apply_trace(
|
||||
std::vector<stacktrace_frame>& result,
|
||||
std::vector<stacktrace_frame>&& trace
|
||||
@ -51,5 +52,5 @@ namespace cpptrace {
|
||||
#endif
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
#include "../platform/object.hpp"
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace addr2line {
|
||||
namespace detail {
|
||||
namespace addr2line {
|
||||
#if IS_LINUX || IS_APPLE
|
||||
bool has_addr2line() {
|
||||
static std::mutex mutex;
|
||||
@ -345,8 +345,8 @@ namespace cpptrace {
|
||||
}
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
#include <dbghelp.h>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace dbghelp {
|
||||
namespace detail {
|
||||
namespace dbghelp {
|
||||
|
||||
// SymFromAddr only returns the function's name. In order to get information about parameters,
|
||||
// important for C++ stack traces where functions may be overloaded, we have to manually use
|
||||
@ -422,8 +422,8 @@ namespace cpptrace {
|
||||
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace libdl {
|
||||
namespace detail {
|
||||
namespace libdl {
|
||||
stacktrace_frame resolve_frame(const void* addr) {
|
||||
Dl_info info;
|
||||
if(dladdr(addr, &info)) { // thread-safe
|
||||
@ -41,8 +41,8 @@ namespace cpptrace {
|
||||
}
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#endif
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace libbacktrace {
|
||||
namespace detail {
|
||||
namespace libbacktrace {
|
||||
int full_callback(void* data, uintptr_t address, const char* file, int line, const char* symbol) {
|
||||
stacktrace_frame& frame = *static_cast<stacktrace_frame*>(data);
|
||||
if(line == 0) {
|
||||
@ -89,8 +89,8 @@ namespace cpptrace {
|
||||
}
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -200,8 +200,8 @@ static int dwarf4_ranges(
|
||||
}
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace libdwarf {
|
||||
namespace detail {
|
||||
namespace libdwarf {
|
||||
// printbugging as we go
|
||||
constexpr bool dump_dwarf = false;
|
||||
constexpr bool trace_dwarf = false;
|
||||
@ -1083,8 +1083,8 @@ namespace cpptrace {
|
||||
}
|
||||
return trace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace nothing {
|
||||
namespace detail {
|
||||
namespace nothing {
|
||||
std::vector<stacktrace_frame> resolve_frames(const std::vector<void*>& frames) {
|
||||
return std::vector<stacktrace_frame>(frames.size(), {
|
||||
0,
|
||||
@ -17,8 +17,8 @@ namespace cpptrace {
|
||||
""
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
#ifdef CPPTRACE_HARD_MAX_FRAMES
|
||||
constexpr size_t hard_max_frames = CPPTRACE_HARD_MAX_FRAMES;
|
||||
#else
|
||||
@ -16,7 +16,7 @@ namespace cpptrace {
|
||||
#endif
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
std::vector<void*> capture_frames(size_t skip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include <execinfo.h>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
std::vector<void*> capture_frames(size_t skip) {
|
||||
std::vector<void*> frames(hard_max_frames + skip, nullptr);
|
||||
@ -21,7 +21,7 @@ namespace cpptrace {
|
||||
frames.shrink_to_fit();
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
#include <vector>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
std::vector<void*> capture_frames(size_t) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include <unwind.h>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
struct unwind_state {
|
||||
std::size_t skip;
|
||||
std::size_t count;
|
||||
@ -58,7 +58,7 @@ namespace cpptrace {
|
||||
frames.shrink_to_fit();
|
||||
return frames;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
namespace cpptrace {
|
||||
namespace detail {
|
||||
namespace detail {
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
std::vector<void*> capture_frames(size_t skip) {
|
||||
std::vector<PVOID> addrs(hard_max_frames, nullptr);
|
||||
@ -19,7 +19,7 @@ namespace cpptrace {
|
||||
addrs.shrink_to_fit();
|
||||
return addrs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user