OLD | NEW |
1 // Copyright (c) 2010 Google Inc. All Rights Reserved. | 1 // Copyright (c) 2010 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following disclaimer | 10 // copyright notice, this list of conditions and the following disclaimer |
(...skipping 13 matching lines...) Expand all Loading... |
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> | 29 // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> |
30 | 30 |
31 // dwarf2diehandler.cc: Implement the dwarf2reader::DieDispatcher class. | 31 // dwarf2diehandler.cc: Implement the dwarf2reader::DieDispatcher class. |
32 // See dwarf2diehandler.h for details. | 32 // See dwarf2diehandler.h for details. |
33 | 33 |
| 34 #include <assert.h> |
| 35 |
| 36 #include <string> |
| 37 |
34 #include "common/dwarf/dwarf2diehandler.h" | 38 #include "common/dwarf/dwarf2diehandler.h" |
35 | 39 #include "common/using_std_string.h" |
36 #include <assert.h> | |
37 | 40 |
38 namespace dwarf2reader { | 41 namespace dwarf2reader { |
39 | 42 |
40 DIEDispatcher::~DIEDispatcher() { | 43 DIEDispatcher::~DIEDispatcher() { |
41 while (!die_handlers_.empty()) { | 44 while (!die_handlers_.empty()) { |
42 HandlerStack &entry = die_handlers_.top(); | 45 HandlerStack &entry = die_handlers_.top(); |
43 if (entry.handler_ != root_handler_) | 46 if (entry.handler_ != root_handler_) |
44 delete entry.handler_; | 47 delete entry.handler_; |
45 die_handlers_.pop(); | 48 die_handlers_.pop(); |
46 } | 49 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 uint64 len) { | 172 uint64 len) { |
170 HandlerStack ¤t = die_handlers_.top(); | 173 HandlerStack ¤t = die_handlers_.top(); |
171 // This had better be an attribute of the DIE we were meant to handle. | 174 // This had better be an attribute of the DIE we were meant to handle. |
172 assert(offset == current.offset_); | 175 assert(offset == current.offset_); |
173 current.handler_->ProcessAttributeBuffer(attr, form, data, len); | 176 current.handler_->ProcessAttributeBuffer(attr, form, data, len); |
174 } | 177 } |
175 | 178 |
176 void DIEDispatcher::ProcessAttributeString(uint64 offset, | 179 void DIEDispatcher::ProcessAttributeString(uint64 offset, |
177 enum DwarfAttribute attr, | 180 enum DwarfAttribute attr, |
178 enum DwarfForm form, | 181 enum DwarfForm form, |
179 const std::string& data) { | 182 const string& data) { |
180 HandlerStack ¤t = die_handlers_.top(); | 183 HandlerStack ¤t = die_handlers_.top(); |
181 // This had better be an attribute of the DIE we were meant to handle. | 184 // This had better be an attribute of the DIE we were meant to handle. |
182 assert(offset == current.offset_); | 185 assert(offset == current.offset_); |
183 current.handler_->ProcessAttributeString(attr, form, data); | 186 current.handler_->ProcessAttributeString(attr, form, data); |
184 } | 187 } |
185 | 188 |
186 void DIEDispatcher::ProcessAttributeSignature(uint64 offset, | 189 void DIEDispatcher::ProcessAttributeSignature(uint64 offset, |
187 enum DwarfAttribute attr, | 190 enum DwarfAttribute attr, |
188 enum DwarfForm form, | 191 enum DwarfForm form, |
189 uint64 signature) { | 192 uint64 signature) { |
190 HandlerStack ¤t = die_handlers_.top(); | 193 HandlerStack ¤t = die_handlers_.top(); |
191 // This had better be an attribute of the DIE we were meant to handle. | 194 // This had better be an attribute of the DIE we were meant to handle. |
192 assert(offset == current.offset_); | 195 assert(offset == current.offset_); |
193 current.handler_->ProcessAttributeSignature(attr, form, signature); | 196 current.handler_->ProcessAttributeSignature(attr, form, signature); |
194 } | 197 } |
195 | 198 |
196 } // namespace dwarf2reader | 199 } // namespace dwarf2reader |
OLD | NEW |