| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#pragma once |
|
2
|
|
|
|
|
|
|
#include |
|
3
|
|
|
|
|
|
|
#include |
|
4
|
|
|
|
|
|
|
#include "string.h" |
|
5
|
|
|
|
|
|
|
#include "refcnt.h" |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
namespace panda { |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
struct Stackframe: public Refcnt { |
|
10
|
|
|
|
|
|
|
string file; |
|
11
|
|
|
|
|
|
|
string library; |
|
12
|
|
|
|
|
|
|
string name; |
|
13
|
|
|
|
|
|
|
string mangled_name; |
|
14
|
|
|
|
|
|
|
std::uint64_t address = 0; |
|
15
|
|
|
|
|
|
|
std::uint64_t offset = 0; |
|
16
|
|
|
|
|
|
|
std::uint64_t line_no = 0; |
|
17
|
|
|
|
|
|
|
}; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
using StackframePtr = iptr; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
struct BacktraceInfo : Refcnt { |
|
22
|
|
|
|
|
|
|
virtual ~BacktraceInfo(); |
|
23
|
|
|
|
|
|
|
virtual const std::vector& get_frames() const = 0; |
|
24
|
|
|
|
|
|
|
virtual string to_string() const = 0; |
|
25
|
|
|
|
|
|
|
}; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
using RawTrace = std::vector; |
|
28
|
|
|
|
|
|
|
using BacktraceProducer = iptr(*)(const RawTrace&); |
|
29
|
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
struct Backtrace { |
|
31
|
|
|
|
|
|
|
static const constexpr int max_depth = 50; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Backtrace () noexcept; |
|
34
|
|
|
|
|
|
|
Backtrace (const Backtrace &other) noexcept; |
|
35
|
|
|
|
|
|
|
virtual ~Backtrace (); |
|
36
|
|
|
|
|
|
|
Backtrace& operator=(const Backtrace& other) = default; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
iptr get_backtrace_info() const noexcept; |
|
39
|
|
|
|
|
|
|
const RawTrace& get_trace () const noexcept { return buffer; } |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
static void install_producer(BacktraceProducer& producer); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
private: |
|
44
|
|
|
|
|
|
|
std::vector buffer; |
|
45
|
|
|
|
|
|
|
}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
template |
|
48
|
|
|
|
|
|
|
struct bt : T, Backtrace { |
|
49
|
|
|
|
|
|
|
template |
|
50
|
|
|
|
|
|
|
bt (Args&&... args) noexcept : T(std::forward(args...)) {} |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
2
|
50
|
|
|
|
|
struct exception : std::exception, Backtrace { |
|
54
|
|
|
|
|
|
|
exception () noexcept; |
|
55
|
|
|
|
|
|
|
exception (const string& whats) noexcept; |
|
56
|
|
|
|
|
|
|
exception (const exception& oth) noexcept; |
|
57
|
|
|
|
|
|
|
exception& operator= (const exception& oth) noexcept; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
const char* what () const noexcept override; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
virtual string whats () const noexcept; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
private: |
|
64
|
|
|
|
|
|
|
mutable string _whats; |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |