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