OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "dwarf_reader/dwarf_info_parser.h" | |
6 #include "dwarf_reader/dwarf_reader.h" | |
7 #include "dwarf_reader/parse_state.h" | |
8 | |
9 namespace dwarf_reader { | |
10 | |
11 DwarfInfoParser::DwarfInfoParser(dwarf_reader::ParseState *parse_state, | |
12 IDwarfReader *reader) | |
13 : parse_state_(parse_state), | |
14 reader_(reader) {} | |
15 | |
16 bool DwarfInfoParser::StartCompilationUnit(uint64 offset, | |
17 uint8 address_size, | |
18 uint8 offset_size, | |
19 uint64 compilation_unit_length, | |
20 uint8 dwarf_version) { | |
21 void *context = reader_->StartCompilationUnit( | |
22 offset, | |
23 address_size, | |
24 offset_size, | |
25 compilation_unit_length, | |
26 dwarf_version); | |
27 | |
28 parse_state_->set_current_compilation_unit(context); | |
29 parse_state_->PushStackFrame(context, offset); | |
30 return true; | |
31 } | |
32 | |
33 bool DwarfInfoParser::StartDIE( | |
34 uint64 offset, | |
35 enum DwarfTag tag, | |
36 const dwarf2reader::AttributeList& attributes) { | |
37 void *context = reader_->StartDIE( | |
38 parse_state_->GetTopStackContext(), | |
39 parse_state_->GetTopStackAddress(), | |
40 offset, | |
41 tag); | |
42 parse_state_->PushStackFrame(context, offset); | |
43 return true; | |
44 } | |
45 | |
46 void DwarfInfoParser::EndDIE(uint64 offset) { | |
47 reader_->EndDIE(parse_state_->GetTopStackContext(), | |
48 parse_state_->GetTopStackAddress()); | |
49 parse_state_->PopStackFrame(); | |
50 } | |
51 | |
52 void DwarfInfoParser::ProcessAttributeUnsigned( | |
53 uint64 offset, | |
54 enum DwarfAttribute attribute, | |
55 enum DwarfForm form, | |
56 uint64 data) { | |
57 reader_->ProcessAttributeUnsigned( | |
58 parse_state_->GetTopStackContext(), | |
59 parse_state_->GetTopStackAddress(), | |
60 offset, | |
61 attribute, | |
62 form, | |
63 data); | |
64 } | |
65 | |
66 void DwarfInfoParser::ProcessAttributeSigned( | |
67 uint64 offset, | |
68 enum DwarfAttribute attribute, | |
69 enum DwarfForm form, | |
70 int64 data) { | |
71 reader_->ProcessAttributeSigned( | |
72 parse_state_->GetTopStackContext(), | |
73 parse_state_->GetTopStackAddress(), | |
74 offset, | |
75 attribute, | |
76 form, | |
77 data); | |
78 } | |
79 | |
80 void DwarfInfoParser::ProcessAttributeReference( | |
81 uint64 offset, | |
82 enum DwarfAttribute attribute, | |
83 enum DwarfForm form, | |
84 uint64 data) { | |
85 reader_->ProcessAttributeReference( | |
86 parse_state_->GetTopStackContext(), | |
87 parse_state_->GetTopStackAddress(), | |
88 offset, | |
89 attribute, | |
90 form, | |
91 data); | |
92 } | |
93 | |
94 void DwarfInfoParser::ProcessAttributeBuffer(uint64 offset, | |
95 enum DwarfAttribute attribute, | |
96 enum DwarfForm form, | |
97 const char* data, | |
98 uint64 len) { | |
99 reader_->ProcessAttributeBuffer( | |
100 parse_state_->GetTopStackContext(), | |
101 parse_state_->GetTopStackAddress(), | |
102 offset, | |
103 attribute, | |
104 form, | |
105 data, | |
106 len); | |
107 } | |
108 | |
109 void DwarfInfoParser::ProcessAttributeString(uint64 offset, | |
110 enum DwarfAttribute attribute, | |
111 enum DwarfForm form, | |
112 const string& data) { | |
113 reader_->ProcessAttributeString( | |
114 parse_state_->GetTopStackContext(), | |
115 parse_state_->GetTopStackAddress(), | |
116 offset, | |
117 attribute, | |
118 form, | |
119 data.data()); | |
120 } | |
121 | |
122 } // namespace dwarf_reader | |
OLD | NEW |