Debian Codegraph @

src/symbols/dwarf/resolver.hpp

raw
1 #ifndef SYMBOL_RESOLVER_HPP
2 #define SYMBOL_RESOLVER_HPP
3
4 #include <cpptrace/basic.hpp>
5 #include "symbols/symbols.hpp"
6 #include "platform/platform.hpp"
7 #include "utils/string_view.hpp"
8
9 #include <memory>
10
11 #if false
12 #define CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING CPPTRACE_FORCE_NO_INLINE
13 #else
14 #define CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING
15 #endif
16
17 CPPTRACE_BEGIN_NAMESPACE
18 namespace detail {
19 namespace libdwarf {
20 class symbol_resolver {
21 public:
22 virtual ~symbol_resolver() = default;
23 CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING
24 virtual frame_with_inlines resolve_frame(const object_frame& frame_info) = 0;
25 };
26
27 class null_resolver : public symbol_resolver {
28 public:
29 explicit null_resolver() = default;
30 null_resolver(cstring_view) {}
31
32 CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING
33 frame_with_inlines resolve_frame(const object_frame& frame_info) override {
34 return {
35 {
36 frame_info.raw_address,
37 frame_info.object_address,
38 nullable<std::uint32_t>::null(),
39 nullable<std::uint32_t>::null(),
40 frame_info.object_path,
41 "",
42 false
43 },
44 {}
45 };
46 };
47 };
48
49 std::unique_ptr<symbol_resolver> make_dwarf_resolver(cstring_view object_path);
50 #if IS_APPLE
51 std::unique_ptr<symbol_resolver> make_debug_map_resolver(const std::string& object_path);
52 #endif
53 }
54 }
55 CPPTRACE_END_NAMESPACE
56
57 #endif