line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "exception.h" |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
#include |
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#if defined(__unix__) |
7
|
|
|
|
|
|
|
#include |
8
|
|
|
|
|
|
|
#endif |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
namespace panda { |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
|
|
|
|
BacktraceInfo::~BacktraceInfo() {}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
static BacktraceProducer* producer = nullptr; |
16
|
|
|
|
|
|
|
|
17
|
18
|
|
|
|
|
|
void Backtrace::install_producer(BacktraceProducer& producer_) { |
18
|
18
|
|
|
|
|
|
producer = &producer_; |
19
|
18
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
Backtrace::Backtrace (const Backtrace& other) noexcept : buffer(other.buffer) {} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#if defined(__unix__) |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
Backtrace::Backtrace () noexcept { |
26
|
0
|
|
|
|
|
|
buffer.resize(max_depth); |
27
|
0
|
|
|
|
|
|
auto depth = ::backtrace(buffer.data(), max_depth); |
28
|
0
|
|
|
|
|
|
buffer.resize(depth); |
29
|
0
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
Backtrace::~Backtrace() {} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
iptr Backtrace::get_backtrace_info() const noexcept { |
34
|
0
|
0
|
|
|
|
|
if (producer) { return (*producer)(buffer); } |
35
|
0
|
|
|
|
|
|
return iptr(); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#else |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
backtrace::backtrace () noexcept {} |
41
|
|
|
|
|
|
|
string backtrace::get_trace_string () const { return {}; } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#endif |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
exception::exception () noexcept {} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
exception::exception (const string& whats) noexcept : _whats(whats) {} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
exception::exception (const exception& oth) noexcept : Backtrace(oth), _whats(oth._whats) {} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
exception& exception::operator= (const exception& oth) noexcept { |
53
|
0
|
|
|
|
|
|
_whats = oth._whats; |
54
|
0
|
|
|
|
|
|
Backtrace::operator=(oth); |
55
|
0
|
|
|
|
|
|
return *this; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
const char* exception::what () const noexcept { |
59
|
0
|
|
|
|
|
|
_whats = whats(); |
60
|
0
|
|
|
|
|
|
return _whats.c_str(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
string exception::whats () const noexcept { |
64
|
0
|
|
|
|
|
|
return _whats; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |