1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#ifndef DWARFLINT_PRI_H
#define DWARFLINT_PRI_H
#include <libdw.h>
#include <string>
namespace pri
{
class pribase
{
std::string m_s;
protected:
pribase (std::string const &a,
std::string const &b = "",
std::string const &c = "")
: m_s (a + b + c)
{}
friend std::ostream &operator << (std::ostream &os, pribase const &obj);
public:
operator std::string const &() const { return m_s; }
};
std::ostream &operator << (std::ostream &os, pribase const &obj);
struct not_enough
: public pribase
{
not_enough (std::string const &what)
: pribase ("not enough data for ", what)
{}
};
struct lacks_relocation
: public pribase
{
lacks_relocation (std::string const &what)
: pribase (what, " seems to lack a relocation")
{}
};
struct attr
: public pribase
{
attr (int attr_name);
};
struct form
: public pribase
{
form (int attr_form);
};
struct tag
: public pribase
{
tag (int tag);
};
struct locexpr_opcode
: public pribase
{
locexpr_opcode (int opcode);
};
class ref
{
Dwarf_Off off;
public:
template <class T>
ref (T const &die)
: off (die.offset ())
{}
friend std::ostream &operator << (std::ostream &os, ref const &obj);
};
std::ostream &operator << (std::ostream &os, ref const &obj);
class hex
{
Dwarf_Off value;
char const *const pre;
public:
hex (Dwarf_Off a_value, char const *a_pre = NULL)
: value (a_value)
, pre (a_pre)
{}
friend std::ostream &operator << (std::ostream &os, hex const &obj);
};
std::ostream &operator << (std::ostream &os, hex const &obj);
struct addr: public hex {
addr (Dwarf_Off off) : hex (off) {}
};
struct DIE: public hex {
DIE (Dwarf_Off off) : hex (off, "DIE ") {}
};
struct CU: public hex {
CU (Dwarf_Off off) : hex (off, "CU ") {}
};
class range
{
Dwarf_Off start;
Dwarf_Off end;
public:
range (Dwarf_Off a_start, Dwarf_Off a_end)
: start (a_start), end (a_end)
{}
friend std::ostream &operator << (std::ostream &os, range const &obj);
};
std::ostream &operator << (std::ostream &os, range const &obj);
}
#endif//DWARFLINT_PRI_H
|