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
|
4
|
50
|
|
|
|
|
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
|
6
|
|
|
|
|
|
Backtrace::Backtrace () noexcept { |
26
|
3
|
|
|
|
|
|
buffer.resize(max_depth); |
27
|
3
|
|
|
|
|
|
auto depth = ::backtrace(buffer.data(), max_depth); |
28
|
3
|
|
|
|
|
|
buffer.resize(depth); |
29
|
3
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#else |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Backtrace::Backtrace () noexcept {} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#endif |
36
|
|
|
|
|
|
|
|
37
|
6
|
50
|
|
|
|
|
Backtrace::~Backtrace() {} |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
|
iptr Backtrace::get_backtrace_info() const noexcept { |
40
|
2
|
50
|
|
|
|
|
if (producer) { return (*producer)(buffer); } |
41
|
0
|
|
|
|
|
|
return iptr(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
exception::exception () noexcept {} |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
|
exception::exception (const string& whats) noexcept : _whats(whats) {} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
exception::exception (const exception& oth) noexcept : Backtrace(oth), _whats(oth._whats) {} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
exception& exception::operator= (const exception& oth) noexcept { |
51
|
0
|
|
|
|
|
|
_whats = oth._whats; |
52
|
0
|
|
|
|
|
|
Backtrace::operator=(oth); |
53
|
0
|
|
|
|
|
|
return *this; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
const char* exception::what () const noexcept { |
57
|
0
|
|
|
|
|
|
_whats = whats(); |
58
|
0
|
|
|
|
|
|
return _whats.c_str(); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
|
string exception::whats () const noexcept { |
62
|
1
|
|
|
|
|
|
return _whats; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |