Files
ternfs-XTXMarkets/cpp/Backtrace.hpp
Francesco Mazzoli fc0cee0e07 C++ shard
Most operations apart from spans-related ones work. Using this as
a checkpoint -- the Python code is currently not really working,
I'm working to migrate to pretty much a full C++/go world.
2022-12-10 10:55:25 +00:00

31 lines
842 B
C++

#pragma once
#include <memory>
#include "SBRMUnix.hpp"
#include "Common.hpp"
struct ProgramInfo {
ProgramInfo() = default;
ProgramInfo(ProgramInfo&&) = default;
~ProgramInfo() = default;
ProgramInfo(const ProgramInfo &) = delete;
ProgramInfo& operator=(const ProgramInfo &) = delete;
static std::shared_ptr<ProgramInfo> Self();
static std::shared_ptr<ProgramInfo> ForBinary(const char *exePath, bool required = true);
size_t getBacktraceSegment(void *ip, char* buf, size_t sz, int* count = nullptr);
// private
DynamicMMapHolder<char*> _data;
};
size_t getBacktraceInstructionPointers(void** ips, size_t maxIPs) __attribute__((noinline));
size_t generateBacktrace(char * buf, size_t sz);
void loadAndSendEmptyProgramInfo(int out_fd);
void loadAndSendProgramInfo(const char* exePath, int out_fd);