-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer_type.cc
More file actions
66 lines (50 loc) · 1.04 KB
/
pointer_type.cc
File metadata and controls
66 lines (50 loc) · 1.04 KB
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
#include <cassert>
#include <dwarf.h>
#include <libdwarf.h>
#include "common.h"
#include "pointer_type.h"
using std::map;
using std::ostream;
using std::endl;
PointerType::PointerType(Dwarf_Off id)
: Type(id)
{
}
int
PointerType::init(Dwarf_Debug dbg, map<Dwarf_Off, Type*>& types)
{
Dwarf_Die die;
Dwarf_Error err;
Dwarf_Attribute attr;
Dwarf_Off baseTypeId;
int rc;
rc = dwarf_offdie(dbg, this->id(), &die, &err);
assert(rc == DW_DLV_OK);
rc = dwarf_attr(die, DW_AT_type, &attr, &err);
assert(rc == DW_DLV_OK);
rc = dwarf_global_formref(attr, &baseTypeId, &err);
assert(rc == DW_DLV_OK);
map<Dwarf_Off, Type*>::iterator it = types.find(baseTypeId);
assert(it != types.end());
baseType_ = it->second;
rc = get_attr_udata(die, DW_AT_byte_size, &size_);
assert(rc == 0);
return 0;
}
int
PointerType::dumpData(void* data, int indent, ostream& out)
{
(void) indent;
out << data;
return 0;
}
Dwarf_Unsigned
PointerType::size() const
{
return size_;
}
bool
PointerType::isCharacter() const
{
return false;
}