-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconst_type.cc
More file actions
57 lines (43 loc) · 937 Bytes
/
const_type.cc
File metadata and controls
57 lines (43 loc) · 937 Bytes
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
#include <cassert>
#include <dwarf.h>
#include <libdwarf.h>
#include "common.h"
#include "const_type.h"
using std::map;
using std::ostream;
ConstType::ConstType(Dwarf_Off id)
: Type(id)
{
}
int
ConstType::init(Dwarf_Debug dbg, map<Dwarf_Off, Type*>& types)
{
Dwarf_Error err;
Dwarf_Die die;
Dwarf_Off baseTypeOff;
Dwarf_Attribute attr;
int rc;
rc = dwarf_offdie(dbg, 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, &baseTypeOff, &err);
assert(rc == DW_DLV_OK);
baseType_ = types[baseTypeOff];
return 0;
}
int
ConstType::dumpData(void* data UNUSED, int indent UNUSED, ostream& out UNUSED)
{
return this->baseType_->dumpData(data, indent, out);
}
Dwarf_Unsigned
ConstType::size() const
{
return baseType_->size();
}
bool
ConstType::isCharacter() const
{
return baseType_->isCharacter();
}