| OLD | NEW |
| 1 // -*- mode: C++ -*- | 1 // -*- mode: C++ -*- |
| 2 | 2 |
| 3 // Copyright (c) 2010 Google Inc. All Rights Reserved. | 3 // Copyright (c) 2010 Google Inc. All Rights Reserved. |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // This file contains definitions related to the DWARF2/3 reader and | 33 // This file contains definitions related to the DWARF2/3 reader and |
| 34 // it's handler interfaces. | 34 // it's handler interfaces. |
| 35 // The DWARF2/3 specification can be found at | 35 // The DWARF2/3 specification can be found at |
| 36 // http://dwarf.freestandards.org and should be considered required | 36 // http://dwarf.freestandards.org and should be considered required |
| 37 // reading if you wish to modify the implementation. | 37 // reading if you wish to modify the implementation. |
| 38 // Only a cursory attempt is made to explain terminology that is | 38 // Only a cursory attempt is made to explain terminology that is |
| 39 // used here, as it is much better explained in the standard documents | 39 // used here, as it is much better explained in the standard documents |
| 40 #ifndef COMMON_DWARF_DWARF2READER_H__ | 40 #ifndef COMMON_DWARF_DWARF2READER_H__ |
| 41 #define COMMON_DWARF_DWARF2READER_H__ | 41 #define COMMON_DWARF_DWARF2READER_H__ |
| 42 | 42 |
| 43 #include <stdint.h> |
| 44 |
| 43 #include <list> | 45 #include <list> |
| 44 #include <map> | 46 #include <map> |
| 45 #include <string> | 47 #include <string> |
| 46 #include <utility> | 48 #include <utility> |
| 47 #include <vector> | 49 #include <vector> |
| 48 | 50 |
| 49 #include "common/dwarf/bytereader.h" | 51 #include "common/dwarf/bytereader.h" |
| 50 #include "common/dwarf/dwarf2enums.h" | 52 #include "common/dwarf/dwarf2enums.h" |
| 51 #include "common/dwarf/types.h" | 53 #include "common/dwarf/types.h" |
| 52 #include "common/using_std_string.h" | 54 #include "common/using_std_string.h" |
| 53 | 55 |
| 54 namespace dwarf2reader { | 56 namespace dwarf2reader { |
| 55 struct LineStateMachine; | 57 struct LineStateMachine; |
| 56 class Dwarf2Handler; | 58 class Dwarf2Handler; |
| 57 class LineInfoHandler; | 59 class LineInfoHandler; |
| 58 | 60 |
| 59 // This maps from a string naming a section to a pair containing a | 61 // This maps from a string naming a section to a pair containing a |
| 60 // the data for the section, and the size of the section. | 62 // the data for the section, and the size of the section. |
| 61 typedef std::map<string, std::pair<const char*, uint64> > SectionMap; | 63 typedef std::map<string, std::pair<const uint8_t *, uint64> > SectionMap; |
| 62 typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> > | 64 typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> > |
| 63 AttributeList; | 65 AttributeList; |
| 64 typedef AttributeList::iterator AttributeIterator; | 66 typedef AttributeList::iterator AttributeIterator; |
| 65 typedef AttributeList::const_iterator ConstAttributeIterator; | 67 typedef AttributeList::const_iterator ConstAttributeIterator; |
| 66 | 68 |
| 67 struct LineInfoHeader { | 69 struct LineInfoHeader { |
| 68 uint64 total_length; | 70 uint64 total_length; |
| 69 uint16 version; | 71 uint16 version; |
| 70 uint64 prologue_length; | 72 uint64 prologue_length; |
| 71 uint8 min_insn_length; // insn stands for instructin | 73 uint8 min_insn_length; // insn stands for instructin |
| 72 bool default_is_stmt; // stmt stands for statement | 74 bool default_is_stmt; // stmt stands for statement |
| 73 int8 line_base; | 75 int8 line_base; |
| 74 uint8 line_range; | 76 uint8 line_range; |
| 75 uint8 opcode_base; | 77 uint8 opcode_base; |
| 76 // Use a pointer so that signalsafe_addr2line is able to use this structure | 78 // Use a pointer so that signalsafe_addr2line is able to use this structure |
| 77 // without heap allocation problem. | 79 // without heap allocation problem. |
| 78 std::vector<unsigned char> *std_opcode_lengths; | 80 std::vector<unsigned char> *std_opcode_lengths; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 class LineInfo { | 83 class LineInfo { |
| 82 public: | 84 public: |
| 83 | 85 |
| 84 // Initializes a .debug_line reader. Buffer and buffer length point | 86 // Initializes a .debug_line reader. Buffer and buffer length point |
| 85 // to the beginning and length of the line information to read. | 87 // to the beginning and length of the line information to read. |
| 86 // Reader is a ByteReader class that has the endianness set | 88 // Reader is a ByteReader class that has the endianness set |
| 87 // properly. | 89 // properly. |
| 88 LineInfo(const char* buffer_, uint64 buffer_length, | 90 LineInfo(const uint8_t *buffer_, uint64 buffer_length, |
| 89 ByteReader* reader, LineInfoHandler* handler); | 91 ByteReader* reader, LineInfoHandler* handler); |
| 90 | 92 |
| 91 virtual ~LineInfo() { | 93 virtual ~LineInfo() { |
| 92 if (header_.std_opcode_lengths) { | 94 if (header_.std_opcode_lengths) { |
| 93 delete header_.std_opcode_lengths; | 95 delete header_.std_opcode_lengths; |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 | 98 |
| 97 // Start processing line info, and calling callbacks in the handler. | 99 // Start processing line info, and calling callbacks in the handler. |
| 98 // Consumes the line number information for a single compilation unit. | 100 // Consumes the line number information for a single compilation unit. |
| 99 // Returns the number of bytes processed. | 101 // Returns the number of bytes processed. |
| 100 uint64 Start(); | 102 uint64 Start(); |
| 101 | 103 |
| 102 // Process a single line info opcode at START using the state | 104 // Process a single line info opcode at START using the state |
| 103 // machine at LSM. Return true if we should define a line using the | 105 // machine at LSM. Return true if we should define a line using the |
| 104 // current state of the line state machine. Place the length of the | 106 // current state of the line state machine. Place the length of the |
| 105 // opcode in LEN. | 107 // opcode in LEN. |
| 106 // If LSM_PASSES_PC is non-NULL, this function also checks if the lsm | 108 // If LSM_PASSES_PC is non-NULL, this function also checks if the lsm |
| 107 // passes the address of PC. In other words, LSM_PASSES_PC will be | 109 // passes the address of PC. In other words, LSM_PASSES_PC will be |
| 108 // set to true, if the following condition is met. | 110 // set to true, if the following condition is met. |
| 109 // | 111 // |
| 110 // lsm's old address < PC <= lsm's new address | 112 // lsm's old address < PC <= lsm's new address |
| 111 static bool ProcessOneOpcode(ByteReader* reader, | 113 static bool ProcessOneOpcode(ByteReader* reader, |
| 112 LineInfoHandler* handler, | 114 LineInfoHandler* handler, |
| 113 const struct LineInfoHeader &header, | 115 const struct LineInfoHeader &header, |
| 114 const char* start, | 116 const uint8_t *start, |
| 115 struct LineStateMachine* lsm, | 117 struct LineStateMachine* lsm, |
| 116 size_t* len, | 118 size_t* len, |
| 117 uintptr pc, | 119 uintptr pc, |
| 118 bool *lsm_passes_pc); | 120 bool *lsm_passes_pc); |
| 119 | 121 |
| 120 private: | 122 private: |
| 121 // Reads the DWARF2/3 header for this line info. | 123 // Reads the DWARF2/3 header for this line info. |
| 122 void ReadHeader(); | 124 void ReadHeader(); |
| 123 | 125 |
| 124 // Reads the DWARF2/3 line information | 126 // Reads the DWARF2/3 line information |
| 125 void ReadLines(); | 127 void ReadLines(); |
| 126 | 128 |
| 127 // The associated handler to call processing functions in | 129 // The associated handler to call processing functions in |
| 128 LineInfoHandler* handler_; | 130 LineInfoHandler* handler_; |
| 129 | 131 |
| 130 // The associated ByteReader that handles endianness issues for us | 132 // The associated ByteReader that handles endianness issues for us |
| 131 ByteReader* reader_; | 133 ByteReader* reader_; |
| 132 | 134 |
| 133 // A DWARF2/3 line info header. This is not the same size as | 135 // A DWARF2/3 line info header. This is not the same size as |
| 134 // in the actual file, as the one in the file may have a 32 bit or | 136 // in the actual file, as the one in the file may have a 32 bit or |
| 135 // 64 bit lengths | 137 // 64 bit lengths |
| 136 | 138 |
| 137 struct LineInfoHeader header_; | 139 struct LineInfoHeader header_; |
| 138 | 140 |
| 139 // buffer is the buffer for our line info, starting at exactly where | 141 // buffer is the buffer for our line info, starting at exactly where |
| 140 // the line info to read is. after_header is the place right after | 142 // the line info to read is. after_header is the place right after |
| 141 // the end of the line information header. | 143 // the end of the line information header. |
| 142 const char* buffer_; | 144 const uint8_t *buffer_; |
| 143 #ifndef NDEBUG | 145 #ifndef NDEBUG |
| 144 uint64 buffer_length_; | 146 uint64 buffer_length_; |
| 145 #endif | 147 #endif |
| 146 const char* after_header_; | 148 const uint8_t *after_header_; |
| 147 }; | 149 }; |
| 148 | 150 |
| 149 // This class is the main interface between the line info reader and | 151 // This class is the main interface between the line info reader and |
| 150 // the client. The virtual functions inside this get called for | 152 // the client. The virtual functions inside this get called for |
| 151 // interesting events that happen during line info reading. The | 153 // interesting events that happen during line info reading. The |
| 152 // default implementation does nothing | 154 // default implementation does nothing |
| 153 | 155 |
| 154 class LineInfoHandler { | 156 class LineInfoHandler { |
| 155 public: | 157 public: |
| 156 LineInfoHandler() { } | 158 LineInfoHandler() { } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } header_; | 263 } header_; |
| 262 | 264 |
| 263 // Reads the DWARF2/3 header for this compilation unit. | 265 // Reads the DWARF2/3 header for this compilation unit. |
| 264 void ReadHeader(); | 266 void ReadHeader(); |
| 265 | 267 |
| 266 // Reads the DWARF2/3 abbreviations for this compilation unit | 268 // Reads the DWARF2/3 abbreviations for this compilation unit |
| 267 void ReadAbbrevs(); | 269 void ReadAbbrevs(); |
| 268 | 270 |
| 269 // Processes a single DIE for this compilation unit and return a new | 271 // Processes a single DIE for this compilation unit and return a new |
| 270 // pointer just past the end of it | 272 // pointer just past the end of it |
| 271 const char* ProcessDIE(uint64 dieoffset, | 273 const uint8_t *ProcessDIE(uint64 dieoffset, |
| 272 const char* start, | 274 const uint8_t *start, |
| 273 const Abbrev& abbrev); | 275 const Abbrev& abbrev); |
| 274 | 276 |
| 275 // Processes a single attribute and return a new pointer just past the | 277 // Processes a single attribute and return a new pointer just past the |
| 276 // end of it | 278 // end of it |
| 277 const char* ProcessAttribute(uint64 dieoffset, | 279 const uint8_t *ProcessAttribute(uint64 dieoffset, |
| 278 const char* start, | 280 const uint8_t *start, |
| 279 enum DwarfAttribute attr, | 281 enum DwarfAttribute attr, |
| 280 enum DwarfForm form); | 282 enum DwarfForm form); |
| 281 | 283 |
| 282 // Processes all DIEs for this compilation unit | 284 // Processes all DIEs for this compilation unit |
| 283 void ProcessDIEs(); | 285 void ProcessDIEs(); |
| 284 | 286 |
| 285 // Skips the die with attributes specified in ABBREV starting at | 287 // Skips the die with attributes specified in ABBREV starting at |
| 286 // START, and return the new place to position the stream to. | 288 // START, and return the new place to position the stream to. |
| 287 const char* SkipDIE(const char* start, | 289 const uint8_t *SkipDIE(const uint8_t *start, const Abbrev& abbrev); |
| 288 const Abbrev& abbrev); | |
| 289 | 290 |
| 290 // Skips the attribute starting at START, with FORM, and return the | 291 // Skips the attribute starting at START, with FORM, and return the |
| 291 // new place to position the stream to. | 292 // new place to position the stream to. |
| 292 const char* SkipAttribute(const char* start, | 293 const uint8_t *SkipAttribute(const uint8_t *start, enum DwarfForm form); |
| 293 enum DwarfForm form); | |
| 294 | 294 |
| 295 // Offset from section start is the offset of this compilation unit | 295 // Offset from section start is the offset of this compilation unit |
| 296 // from the beginning of the .debug_info section. | 296 // from the beginning of the .debug_info section. |
| 297 uint64 offset_from_section_start_; | 297 uint64 offset_from_section_start_; |
| 298 | 298 |
| 299 // buffer is the buffer for our CU, starting at .debug_info + offset | 299 // buffer is the buffer for our CU, starting at .debug_info + offset |
| 300 // passed in from constructor. | 300 // passed in from constructor. |
| 301 // after_header points to right after the compilation unit header. | 301 // after_header points to right after the compilation unit header. |
| 302 const char* buffer_; | 302 const uint8_t *buffer_; |
| 303 uint64 buffer_length_; | 303 uint64 buffer_length_; |
| 304 const char* after_header_; | 304 const uint8_t *after_header_; |
| 305 | 305 |
| 306 // The associated ByteReader that handles endianness issues for us | 306 // The associated ByteReader that handles endianness issues for us |
| 307 ByteReader* reader_; | 307 ByteReader* reader_; |
| 308 | 308 |
| 309 // The map of sections in our file to buffers containing their data | 309 // The map of sections in our file to buffers containing their data |
| 310 const SectionMap& sections_; | 310 const SectionMap& sections_; |
| 311 | 311 |
| 312 // The associated handler to call processing functions in | 312 // The associated handler to call processing functions in |
| 313 Dwarf2Handler* handler_; | 313 Dwarf2Handler* handler_; |
| 314 | 314 |
| 315 // Set of DWARF2/3 abbreviations for this compilation unit. Indexed | 315 // Set of DWARF2/3 abbreviations for this compilation unit. Indexed |
| 316 // by abbreviation number, which means that abbrevs_[0] is not | 316 // by abbreviation number, which means that abbrevs_[0] is not |
| 317 // valid. | 317 // valid. |
| 318 std::vector<Abbrev>* abbrevs_; | 318 std::vector<Abbrev>* abbrevs_; |
| 319 | 319 |
| 320 // String section buffer and length, if we have a string section. | 320 // String section buffer and length, if we have a string section. |
| 321 // This is here to avoid doing a section lookup for strings in | 321 // This is here to avoid doing a section lookup for strings in |
| 322 // ProcessAttribute, which is in the hot path for DWARF2 reading. | 322 // ProcessAttribute, which is in the hot path for DWARF2 reading. |
| 323 const char* string_buffer_; | 323 const uint8_t *string_buffer_; |
| 324 uint64 string_buffer_length_; | 324 uint64 string_buffer_length_; |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 // This class is the main interface between the reader and the | 327 // This class is the main interface between the reader and the |
| 328 // client. The virtual functions inside this get called for | 328 // client. The virtual functions inside this get called for |
| 329 // interesting events that happen during DWARF2 reading. | 329 // interesting events that happen during DWARF2 reading. |
| 330 // The default implementation skips everything. | 330 // The default implementation skips everything. |
| 331 | 331 |
| 332 class Dwarf2Handler { | 332 class Dwarf2Handler { |
| 333 public: | 333 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 // Called when we have an attribute with a buffer of data to give to our | 377 // Called when we have an attribute with a buffer of data to give to our |
| 378 // handler. The attribute is for the DIE at OFFSET from the beginning of the | 378 // handler. The attribute is for the DIE at OFFSET from the beginning of the |
| 379 // .debug_info section. Its name is ATTR, its form is FORM, DATA points to | 379 // .debug_info section. Its name is ATTR, its form is FORM, DATA points to |
| 380 // the buffer's contents, and its length in bytes is LENGTH. The buffer is | 380 // the buffer's contents, and its length in bytes is LENGTH. The buffer is |
| 381 // owned by the caller, not the callee, and may not persist for very long. | 381 // owned by the caller, not the callee, and may not persist for very long. |
| 382 // If you want the data to be available later, it needs to be copied. | 382 // If you want the data to be available later, it needs to be copied. |
| 383 virtual void ProcessAttributeBuffer(uint64 offset, | 383 virtual void ProcessAttributeBuffer(uint64 offset, |
| 384 enum DwarfAttribute attr, | 384 enum DwarfAttribute attr, |
| 385 enum DwarfForm form, | 385 enum DwarfForm form, |
| 386 const char* data, | 386 const uint8_t *data, |
| 387 uint64 len) { } | 387 uint64 len) { } |
| 388 | 388 |
| 389 // Called when we have an attribute with string data to give to our handler. | 389 // Called when we have an attribute with string data to give to our handler. |
| 390 // The attribute is for the DIE at OFFSET from the beginning of the | 390 // The attribute is for the DIE at OFFSET from the beginning of the |
| 391 // .debug_info section. Its name is ATTR, its form is FORM, and its value is | 391 // .debug_info section. Its name is ATTR, its form is FORM, and its value is |
| 392 // DATA. | 392 // DATA. |
| 393 virtual void ProcessAttributeString(uint64 offset, | 393 virtual void ProcessAttributeString(uint64 offset, |
| 394 enum DwarfAttribute attr, | 394 enum DwarfAttribute attr, |
| 395 enum DwarfForm form, | 395 enum DwarfForm form, |
| 396 const string& data) { } | 396 const string& data) { } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 // could pass false for EH_FRAME, but call READER's Set*Base members. | 632 // could pass false for EH_FRAME, but call READER's Set*Base members. |
| 633 // | 633 // |
| 634 // The extensions the Linux C++ ABI makes to DWARF for exception | 634 // The extensions the Linux C++ ABI makes to DWARF for exception |
| 635 // handling are described here, rather poorly: | 635 // handling are described here, rather poorly: |
| 636 // http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-ge
neric/dwarfext.html | 636 // http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-ge
neric/dwarfext.html |
| 637 // http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-ge
neric/ehframechpt.html | 637 // http://refspecs.linux-foundation.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-ge
neric/ehframechpt.html |
| 638 // | 638 // |
| 639 // The mechanics of C++ exception handling, personality routines, | 639 // The mechanics of C++ exception handling, personality routines, |
| 640 // and language-specific data areas are described here, rather nicely: | 640 // and language-specific data areas are described here, rather nicely: |
| 641 // http://www.codesourcery.com/public/cxx-abi/abi-eh.html | 641 // http://www.codesourcery.com/public/cxx-abi/abi-eh.html |
| 642 CallFrameInfo(const char *buffer, size_t buffer_length, | 642 CallFrameInfo(const uint8_t *buffer, size_t buffer_length, |
| 643 ByteReader *reader, Handler *handler, Reporter *reporter, | 643 ByteReader *reader, Handler *handler, Reporter *reporter, |
| 644 bool eh_frame = false) | 644 bool eh_frame = false) |
| 645 : buffer_(buffer), buffer_length_(buffer_length), | 645 : buffer_(buffer), buffer_length_(buffer_length), |
| 646 reader_(reader), handler_(handler), reporter_(reporter), | 646 reader_(reader), handler_(handler), reporter_(reporter), |
| 647 eh_frame_(eh_frame) { } | 647 eh_frame_(eh_frame) { } |
| 648 | 648 |
| 649 ~CallFrameInfo() { } | 649 ~CallFrameInfo() { } |
| 650 | 650 |
| 651 // Parse the entries in BUFFER, reporting what we find to HANDLER. | 651 // Parse the entries in BUFFER, reporting what we find to HANDLER. |
| 652 // Return true if we reach the end of the section successfully, or | 652 // Return true if we reach the end of the section successfully, or |
| 653 // false if we encounter an error. | 653 // false if we encounter an error. |
| 654 bool Start(); | 654 bool Start(); |
| 655 | 655 |
| 656 // Return the textual name of KIND. For error reporting. | 656 // Return the textual name of KIND. For error reporting. |
| 657 static const char *KindName(EntryKind kind); | 657 static const char *KindName(EntryKind kind); |
| 658 | 658 |
| 659 private: | 659 private: |
| 660 | 660 |
| 661 struct CIE; | 661 struct CIE; |
| 662 | 662 |
| 663 // A CFI entry, either an FDE or a CIE. | 663 // A CFI entry, either an FDE or a CIE. |
| 664 struct Entry { | 664 struct Entry { |
| 665 // The starting offset of the entry in the section, for error | 665 // The starting offset of the entry in the section, for error |
| 666 // reporting. | 666 // reporting. |
| 667 size_t offset; | 667 size_t offset; |
| 668 | 668 |
| 669 // The start of this entry in the buffer. | 669 // The start of this entry in the buffer. |
| 670 const char *start; | 670 const uint8_t *start; |
| 671 | 671 |
| 672 // Which kind of entry this is. | 672 // Which kind of entry this is. |
| 673 // | 673 // |
| 674 // We want to be able to use this for error reporting even while we're | 674 // We want to be able to use this for error reporting even while we're |
| 675 // in the midst of parsing. Error reporting code may assume that kind, | 675 // in the midst of parsing. Error reporting code may assume that kind, |
| 676 // offset, and start fields are valid, although kind may be kUnknown. | 676 // offset, and start fields are valid, although kind may be kUnknown. |
| 677 EntryKind kind; | 677 EntryKind kind; |
| 678 | 678 |
| 679 // The end of this entry's common prologue (initial length and id), and | 679 // The end of this entry's common prologue (initial length and id), and |
| 680 // the start of this entry's kind-specific fields. | 680 // the start of this entry's kind-specific fields. |
| 681 const char *fields; | 681 const uint8_t *fields; |
| 682 | 682 |
| 683 // The start of this entry's instructions. | 683 // The start of this entry's instructions. |
| 684 const char *instructions; | 684 const uint8_t *instructions; |
| 685 | 685 |
| 686 // The address past the entry's last byte in the buffer. (Note that | 686 // The address past the entry's last byte in the buffer. (Note that |
| 687 // since offset points to the entry's initial length field, and the | 687 // since offset points to the entry's initial length field, and the |
| 688 // length field is the number of bytes after that field, this is not | 688 // length field is the number of bytes after that field, this is not |
| 689 // simply buffer_ + offset + length.) | 689 // simply buffer_ + offset + length.) |
| 690 const char *end; | 690 const uint8_t *end; |
| 691 | 691 |
| 692 // For both DWARF CFI and .eh_frame sections, this is the CIE id in a | 692 // For both DWARF CFI and .eh_frame sections, this is the CIE id in a |
| 693 // CIE, and the offset of the associated CIE in an FDE. | 693 // CIE, and the offset of the associated CIE in an FDE. |
| 694 uint64 id; | 694 uint64 id; |
| 695 | 695 |
| 696 // The CIE that applies to this entry, if we've parsed it. If this is a | 696 // The CIE that applies to this entry, if we've parsed it. If this is a |
| 697 // CIE, then this field points to this structure. | 697 // CIE, then this field points to this structure. |
| 698 CIE *cie; | 698 CIE *cie; |
| 699 }; | 699 }; |
| 700 | 700 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 class ValExpressionRule; | 757 class ValExpressionRule; |
| 758 class RuleMap; | 758 class RuleMap; |
| 759 class State; | 759 class State; |
| 760 | 760 |
| 761 // Parse the initial length and id of a CFI entry, either a CIE, an FDE, | 761 // Parse the initial length and id of a CFI entry, either a CIE, an FDE, |
| 762 // or a .eh_frame end-of-data mark. CURSOR points to the beginning of the | 762 // or a .eh_frame end-of-data mark. CURSOR points to the beginning of the |
| 763 // data to parse. On success, populate ENTRY as appropriate, and return | 763 // data to parse. On success, populate ENTRY as appropriate, and return |
| 764 // true. On failure, report the problem, and return false. Even if we | 764 // true. On failure, report the problem, and return false. Even if we |
| 765 // return false, set ENTRY->end to the first byte after the entry if we | 765 // return false, set ENTRY->end to the first byte after the entry if we |
| 766 // were able to figure that out, or NULL if we weren't. | 766 // were able to figure that out, or NULL if we weren't. |
| 767 bool ReadEntryPrologue(const char *cursor, Entry *entry); | 767 bool ReadEntryPrologue(const uint8_t *cursor, Entry *entry); |
| 768 | 768 |
| 769 // Parse the fields of a CIE after the entry prologue, including any 'z' | 769 // Parse the fields of a CIE after the entry prologue, including any 'z' |
| 770 // augmentation data. Assume that the 'Entry' fields of CIE are | 770 // augmentation data. Assume that the 'Entry' fields of CIE are |
| 771 // populated; use CIE->fields and CIE->end as the start and limit for | 771 // populated; use CIE->fields and CIE->end as the start and limit for |
| 772 // parsing. On success, populate the rest of *CIE, and return true; on | 772 // parsing. On success, populate the rest of *CIE, and return true; on |
| 773 // failure, report the problem and return false. | 773 // failure, report the problem and return false. |
| 774 bool ReadCIEFields(CIE *cie); | 774 bool ReadCIEFields(CIE *cie); |
| 775 | 775 |
| 776 // Parse the fields of an FDE after the entry prologue, including any 'z' | 776 // Parse the fields of an FDE after the entry prologue, including any 'z' |
| 777 // augmentation data. Assume that the 'Entry' fields of *FDE are | 777 // augmentation data. Assume that the 'Entry' fields of *FDE are |
| 778 // initialized; use FDE->fields and FDE->end as the start and limit for | 778 // initialized; use FDE->fields and FDE->end as the start and limit for |
| 779 // parsing. Assume that FDE->cie is fully initialized. On success, | 779 // parsing. Assume that FDE->cie is fully initialized. On success, |
| 780 // populate the rest of *FDE, and return true; on failure, report the | 780 // populate the rest of *FDE, and return true; on failure, report the |
| 781 // problem and return false. | 781 // problem and return false. |
| 782 bool ReadFDEFields(FDE *fde); | 782 bool ReadFDEFields(FDE *fde); |
| 783 | 783 |
| 784 // Report that ENTRY is incomplete, and return false. This is just a | 784 // Report that ENTRY is incomplete, and return false. This is just a |
| 785 // trivial wrapper for invoking reporter_->Incomplete; it provides a | 785 // trivial wrapper for invoking reporter_->Incomplete; it provides a |
| 786 // little brevity. | 786 // little brevity. |
| 787 bool ReportIncomplete(Entry *entry); | 787 bool ReportIncomplete(Entry *entry); |
| 788 | 788 |
| 789 // Return true if ENCODING has the DW_EH_PE_indirect bit set. | 789 // Return true if ENCODING has the DW_EH_PE_indirect bit set. |
| 790 static bool IsIndirectEncoding(DwarfPointerEncoding encoding) { | 790 static bool IsIndirectEncoding(DwarfPointerEncoding encoding) { |
| 791 return encoding & DW_EH_PE_indirect; | 791 return encoding & DW_EH_PE_indirect; |
| 792 } | 792 } |
| 793 | 793 |
| 794 // The contents of the DWARF .debug_info section we're parsing. | 794 // The contents of the DWARF .debug_info section we're parsing. |
| 795 const char *buffer_; | 795 const uint8_t *buffer_; |
| 796 size_t buffer_length_; | 796 size_t buffer_length_; |
| 797 | 797 |
| 798 // For reading multi-byte values with the appropriate endianness. | 798 // For reading multi-byte values with the appropriate endianness. |
| 799 ByteReader *reader_; | 799 ByteReader *reader_; |
| 800 | 800 |
| 801 // The handler to which we should report the data we find. | 801 // The handler to which we should report the data we find. |
| 802 Handler *handler_; | 802 Handler *handler_; |
| 803 | 803 |
| 804 // For reporting problems in the info we're parsing. | 804 // For reporting problems in the info we're parsing. |
| 805 Reporter *reporter_; | 805 Reporter *reporter_; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 // The name of the file whose CFI we're reading. | 1043 // The name of the file whose CFI we're reading. |
| 1044 string filename_; | 1044 string filename_; |
| 1045 | 1045 |
| 1046 // The name of the CFI section in that file. | 1046 // The name of the CFI section in that file. |
| 1047 string section_; | 1047 string section_; |
| 1048 }; | 1048 }; |
| 1049 | 1049 |
| 1050 } // namespace dwarf2reader | 1050 } // namespace dwarf2reader |
| 1051 | 1051 |
| 1052 #endif // UTIL_DEBUGINFO_DWARF2READER_H__ | 1052 #endif // UTIL_DEBUGINFO_DWARF2READER_H__ |
| OLD | NEW |