| 1 |
#ifndef SYMBOLS_HPP |
| 2 |
#define SYMBOLS_HPP |
| 3 |
|
| 4 |
#include <cpptrace/basic.hpp> |
| 5 |
|
| 6 |
#include <functional> |
| 7 |
#include <string> |
| 8 |
#include <unordered_map> |
| 9 |
#include <utility> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
CPPTRACE_BEGIN_NAMESPACE |
| 13 |
namespace detail { |
| 14 |
using collated_vec = std::vector< |
| 15 |
std::pair<std::reference_wrapper<const object_frame>, std::reference_wrapper<stacktrace_frame>> |
| 16 |
>; |
| 17 |
struct frame_with_inlines { |
| 18 |
stacktrace_frame frame; |
| 19 |
std::vector<stacktrace_frame> inlines; |
| 20 |
}; |
| 21 |
using collated_vec_with_inlines = std::vector< |
| 22 |
std::pair<std::reference_wrapper<const object_frame>, std::reference_wrapper<frame_with_inlines>> |
| 23 |
>; |
| 24 |
|
| 25 |
// These two helpers create a map from a target object to a vector of frames to resolve |
| 26 |
std::unordered_map<std::string, collated_vec> collate_frames( |
| 27 |
const std::vector<object_frame>& frames, |
| 28 |
std::vector<stacktrace_frame>& trace |
| 29 |
); |
| 30 |
std::unordered_map<std::string, collated_vec_with_inlines> collate_frames( |
| 31 |
const std::vector<object_frame>& frames, |
| 32 |
std::vector<frame_with_inlines>& trace |
| 33 |
); |
| 34 |
|
| 35 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE |
| 36 |
namespace libbacktrace { |
| 37 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<frame_ptr>& frames); |
| 38 |
} |
| 39 |
#endif |
| 40 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF |
| 41 |
namespace libdwarf { |
| 42 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames); |
| 43 |
} |
| 44 |
#endif |
| 45 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_LIBDL |
| 46 |
namespace libdl { |
| 47 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<frame_ptr>& frames); |
| 48 |
} |
| 49 |
#endif |
| 50 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE |
| 51 |
namespace addr2line { |
| 52 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames); |
| 53 |
} |
| 54 |
#endif |
| 55 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_DBGHELP |
| 56 |
namespace dbghelp { |
| 57 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<frame_ptr>& frames); |
| 58 |
} |
| 59 |
#endif |
| 60 |
#ifdef CPPTRACE_GET_SYMBOLS_WITH_NOTHING |
| 61 |
namespace nothing { |
| 62 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames); |
| 63 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<frame_ptr>& frames); |
| 64 |
} |
| 65 |
#endif |
| 66 |
|
| 67 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames); |
| 68 |
std::vector<stacktrace_frame> resolve_frames(const std::vector<frame_ptr>& frames); |
| 69 |
} |
| 70 |
CPPTRACE_END_NAMESPACE |
| 71 |
|
| 72 |
#endif |