1 // Copyright 2006 Google Inc. All Rights Reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the names of its 14 // contributors may be used to endorse or promote products derived from 15 // this software without specific prior written permission. 16 // 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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. 28 29 // This file contains definitions related to the DWARF2/3 reader and 30 // it's handler interfaces. 31 // The DWARF2/3 specification can be found at 32 // http://dwarf.freestandards.org and should be considered required 33 // reading if you wish to modify the implementation. 34 // Only a cursory attempt is made to explain terminology that is 35 // used here, as it is much better explained in the standard documents 36 #ifndef COMMON_DWARF_DWARF2READER_H__ 37 #define COMMON_DWARF_DWARF2READER_H__ 38 39 #include <list> 40 #include <map> 41 #include <string> 42 #include <utility> 43 #include <vector> 44 45 #include "common/dwarf/dwarf2enums.h" 46 #include "common/dwarf/types.h" 47 48 using namespace std; 49 50 namespace dwarf2reader { 51 struct LineStateMachine; 52 class ByteReader; 53 class Dwarf2Handler; 54 class LineInfoHandler; 55 class CallFrameInfoHandler; 56 57 // This maps from a string naming a section to a pair containing a 58 // the data for the section, and the size of the section. 59 typedef map<string, pair<const char*, uint64> > SectionMap; 60 typedef list<pair<enum DwarfAttribute, enum DwarfForm> > AttributeList; 61 typedef AttributeList::iterator AttributeIterator; 62 typedef AttributeList::const_iterator ConstAttributeIterator; 63 64 struct LineInfoHeader { 65 uint64 total_length; 66 uint16 version; 67 uint64 prologue_length; 68 uint8 min_insn_length; // insn stands for instructin 69 bool default_is_stmt; // stmt stands for statement 70 int8 line_base; 71 uint8 line_range; 72 uint8 opcode_base; 73 // Use a pointer so that signalsafe_addr2line is able to use this structure 74 // without heap allocation problem. 75 vector<unsigned char> *std_opcode_lengths; 76 }; 77 78 class LineInfo { 79 public: 80 81 // Initializes a .debug_line reader. Buffer and buffer length point 82 // to the beginning and length of the line information to read. 83 // Reader is a ByteReader class that has the endianness set 84 // properly. 85 LineInfo(const char* buffer_, uint64 buffer_length, 86 ByteReader* reader, LineInfoHandler* handler); 87 ~LineInfo()88 virtual ~LineInfo() { 89 if (header_.std_opcode_lengths) { 90 delete header_.std_opcode_lengths; 91 } 92 } 93 94 // Start processing line info, and calling callbacks in the handler. 95 // Consumes the line number information for a single compilation unit. 96 // Returns the number of bytes processed. 97 uint64 Start(); 98 99 // Process a single line info opcode at START using the state 100 // machine at LSM. Return true if we should define a line using the 101 // current state of the line state machine. Place the length of the 102 // opcode in LEN. 103 // If LSM_PASSES_PC is non-NULL, this function also checks if the lsm 104 // passes the address of PC. In other words, LSM_PASSES_PC will be 105 // set to true, if the following condition is met. 106 // 107 // lsm's old address < PC <= lsm's new address 108 static bool ProcessOneOpcode(ByteReader* reader, 109 LineInfoHandler* handler, 110 const struct LineInfoHeader &header, 111 const char* start, 112 struct LineStateMachine* lsm, 113 size_t* len, 114 uintptr_t pc, 115 bool *lsm_passes_pc); 116 117 private: 118 // Reads the DWARF2/3 header for this line info. 119 void ReadHeader(); 120 121 // Reads the DWARF2/3 line information 122 void ReadLines(); 123 124 // The associated handler to call processing functions in 125 LineInfoHandler* handler_; 126 127 // The associated ByteReader that handles endianness issues for us 128 ByteReader* reader_; 129 130 // A DWARF2/3 line info header. This is not the same size as 131 // in the actual file, as the one in the file may have a 32 bit or 132 // 64 bit lengths 133 134 struct LineInfoHeader header_; 135 136 // buffer is the buffer for our line info, starting at exactly where 137 // the line info to read is. after_header is the place right after 138 // the end of the line information header. 139 const char* buffer_; 140 uint64 buffer_length_; 141 const char* after_header_; 142 }; 143 144 // This class is the main interface between the line info reader and 145 // the client. The virtual functions inside this get called for 146 // interesting events that happen during line info reading. The 147 // default implementation does nothing 148 149 class LineInfoHandler { 150 public: LineInfoHandler()151 LineInfoHandler() { } 152 ~LineInfoHandler()153 virtual ~LineInfoHandler() { } 154 155 // Called when we define a directory. NAME is the directory name, 156 // DIR_NUM is the directory number DefineDir(const string & name,uint32 dir_num)157 virtual void DefineDir(const string& name, uint32 dir_num) { } 158 159 // Called when we define a filename. NAME is the filename, FILE_NUM 160 // is the file number which is -1 if the file index is the next 161 // index after the last numbered index (this happens when files are 162 // dynamically defined by the line program), DIR_NUM is the 163 // directory index for the directory name of this file, MOD_TIME is 164 // the modification time of the file, and LENGTH is the length of 165 // the file DefineFile(const string & name,int32 file_num,uint32 dir_num,uint64 mod_time,uint64 length)166 virtual void DefineFile(const string& name, int32 file_num, 167 uint32 dir_num, uint64 mod_time, 168 uint64 length) { } 169 170 // Called when the line info reader has a new line, address pair 171 // ready for us. ADDRESS is the address of the code, FILE_NUM is 172 // the file number containing the code, LINE_NUM is the line number in 173 // that file for the code, and COLUMN_NUM is the column number the code 174 // starts at, if we know it (0 otherwise). AddLine(uint64 address,uint32 file_num,uint32 line_num,uint32 column_num)175 virtual void AddLine(uint64 address, uint32 file_num, uint32 line_num, 176 uint32 column_num) { } 177 178 // Called at the end of a sequence of lines. ADDRESS is the address 179 // of the first byte after the final machine instruction of the 180 // sequence. 181 // 182 // Note that this is *not* necessarily the end of the line data for 183 // the compilation unit: a single compilation unit's line program 184 // may contain several "end of sequence" markers, to describe (for 185 // example) several discontiguous regions of code. EndSequence(uint64 address)186 virtual void EndSequence(uint64 address) { } 187 }; 188 189 // The base of DWARF2/3 debug info is a DIE (Debugging Information 190 // Entry. 191 // DWARF groups DIE's into a tree and calls the root of this tree a 192 // "compilation unit". Most of the time, their is one compilation 193 // unit in the .debug_info section for each file that had debug info 194 // generated. 195 // Each DIE consists of 196 197 // 1. a tag specifying a thing that is being described (ie 198 // DW_TAG_subprogram for functions, DW_TAG_variable for variables, etc 199 // 2. attributes (such as DW_AT_location for location in memory, 200 // DW_AT_name for name), and data for each attribute. 201 // 3. A flag saying whether the DIE has children or not 202 203 // In order to gain some amount of compression, the format of 204 // each DIE (tag name, attributes and data forms for the attributes) 205 // are stored in a separate table called the "abbreviation table". 206 // This is done because a large number of DIEs have the exact same tag 207 // and list of attributes, but different data for those attributes. 208 // As a result, the .debug_info section is just a stream of data, and 209 // requires reading of the .debug_abbrev section to say what the data 210 // means. 211 212 // As a warning to the user, it should be noted that the reason for 213 // using absolute offsets from the beginning of .debug_info is that 214 // DWARF2/3 support referencing DIE's from other DIE's by their offset 215 // from either the current compilation unit start, *or* the beginning 216 // of the .debug_info section. This means it is possible to reference 217 // a DIE in one compilation unit from a DIE in another compilation 218 // unit. This style of reference is usually used to eliminate 219 // duplicated information that occurs across compilation 220 // units, such as base types, etc. GCC 3.4+ support this with 221 // -feliminate-dwarf2-dups. Other toolchains will sometimes do 222 // duplicate elimination in the linker. 223 224 class CompilationUnit { 225 public: 226 227 // Initialize a compilation unit. This requires a map of sections, 228 // the offset of this compilation unit in the debug_info section, a 229 // ByteReader, and a Dwarf2Handler class to call callbacks in. 230 CompilationUnit(const SectionMap& sections, uint64 offset, 231 ByteReader* reader, Dwarf2Handler* handler); ~CompilationUnit()232 virtual ~CompilationUnit() { 233 if (abbrevs_) delete abbrevs_; 234 } 235 236 // Begin reading a Dwarf2 compilation unit, and calling the 237 // callbacks in the Dwarf2Handler 238 239 // Return the full length of the compilation unit, including 240 // headers. This plus the starting offset passed to the constructor 241 // is the offset of the end of the compilation unit --- the start of 242 // the next compilation unit, if there is one. 243 uint64 Start(); 244 245 private: 246 247 // This struct represents a single DWARF2/3 abbreviation 248 // The abbreviation tells how to read a DWARF2/3 DIE, and consist of a 249 // tag and a list of attributes, as well as the data form of each attribute. 250 struct Abbrev { 251 uint32 number; 252 enum DwarfTag tag; 253 bool has_children; 254 AttributeList attributes; 255 }; 256 257 // A DWARF2/3 compilation unit header. This is not the same size as 258 // in the actual file, as the one in the file may have a 32 bit or 259 // 64 bit length. 260 struct CompilationUnitHeader { 261 uint64 length; 262 uint16 version; 263 uint64 abbrev_offset; 264 uint8 address_size; 265 } header_; 266 267 // Reads the DWARF2/3 header for this compilation unit. 268 void ReadHeader(); 269 270 // Reads the DWARF2/3 abbreviations for this compilation unit 271 void ReadAbbrevs(); 272 273 // Processes a single DIE for this compilation unit and return a new 274 // pointer just past the end of it 275 const char* ProcessDIE(uint64 dieoffset, 276 const char* start, 277 const Abbrev& abbrev); 278 279 // Processes a single attribute and return a new pointer just past the 280 // end of it 281 const char* ProcessAttribute(uint64 dieoffset, 282 const char* start, 283 enum DwarfAttribute attr, 284 enum DwarfForm form); 285 286 // Processes all DIEs for this compilation unit 287 void ProcessDIEs(); 288 289 // Skips the die with attributes specified in ABBREV starting at 290 // START, and return the new place to position the stream to. 291 const char* SkipDIE(const char* start, 292 const Abbrev& abbrev); 293 294 // Skips the attribute starting at START, with FORM, and return the 295 // new place to position the stream to. 296 const char* SkipAttribute(const char* start, 297 enum DwarfForm form); 298 299 // Offset from section start is the offset of this compilation unit 300 // from the beginning of the .debug_info section. 301 uint64 offset_from_section_start_; 302 303 // buffer is the buffer for our CU, starting at .debug_info + offset 304 // passed in from constructor. 305 // after_header points to right after the compilation unit header. 306 const char* buffer_; 307 uint64 buffer_length_; 308 const char* after_header_; 309 310 // The associated ByteReader that handles endianness issues for us 311 ByteReader* reader_; 312 313 // The map of sections in our file to buffers containing their data 314 const SectionMap& sections_; 315 316 // The associated handler to call processing functions in 317 Dwarf2Handler* handler_; 318 319 // Set of DWARF2/3 abbreviations for this compilation unit. Indexed 320 // by abbreviation number, which means that abbrevs_[0] is not 321 // valid. 322 vector<Abbrev>* abbrevs_; 323 324 // String section buffer and length, if we have a string section. 325 // This is here to avoid doing a section lookup for strings in 326 // ProcessAttribute, which is in the hot path for DWARF2 reading. 327 const char* string_buffer_; 328 uint64 string_buffer_length_; 329 }; 330 331 // This class is the main interface between the reader and the 332 // client. The virtual functions inside this get called for 333 // interesting events that happen during DWARF2 reading. 334 // The default implementation skips everything. 335 336 class Dwarf2Handler { 337 public: Dwarf2Handler()338 Dwarf2Handler() { } 339 ~Dwarf2Handler()340 virtual ~Dwarf2Handler() { } 341 342 // Start to process a compilation unit at OFFSET from the beginning of the 343 // debug_info section. Return false if you would like 344 // to skip this compilation unit. StartCompilationUnit(uint64 offset,uint8 address_size,uint8 offset_size,uint64 cu_length,uint8 dwarf_version)345 virtual bool StartCompilationUnit(uint64 offset, uint8 address_size, 346 uint8 offset_size, uint64 cu_length, 347 uint8 dwarf_version) { return false; } 348 349 // Start to process a DIE at OFFSET from the beginning of the 350 // debug_info section. Return false if you would like to skip this 351 // DIE. StartDIE(uint64 offset,enum DwarfTag tag,const AttributeList & attrs)352 virtual bool StartDIE(uint64 offset, enum DwarfTag tag, 353 const AttributeList& attrs) { return false; } 354 355 // Called when we have an attribute with unsigned data to give to 356 // our handler. The attribute is for the DIE at OFFSET from the 357 // beginning of compilation unit, has a name of ATTR, a form of 358 // FORM, and the actual data of the attribute is in DATA. ProcessAttributeUnsigned(uint64 offset,enum DwarfAttribute attr,enum DwarfForm form,uint64 data)359 virtual void ProcessAttributeUnsigned(uint64 offset, 360 enum DwarfAttribute attr, 361 enum DwarfForm form, 362 uint64 data) { } 363 364 // Called when we have an attribute with signed data to give to 365 // our handler. The attribute is for the DIE at OFFSET from the 366 // beginning of compilation unit, has a name of ATTR, a form of 367 // FORM, and the actual data of the attribute is in DATA. ProcessAttributeSigned(uint64 offset,enum DwarfAttribute attr,enum DwarfForm form,int64 data)368 virtual void ProcessAttributeSigned(uint64 offset, 369 enum DwarfAttribute attr, 370 enum DwarfForm form, 371 int64 data) { } 372 373 // Called when we have an attribute with a buffer of data to give to 374 // our handler. The attribute is for the DIE at OFFSET from the 375 // beginning of compilation unit, has a name of ATTR, a form of 376 // FORM, and the actual data of the attribute is in DATA, and the 377 // length of the buffer is LENGTH. The buffer is owned by the 378 // caller, not the callee, and may not persist for very long. If 379 // you want the data to be available later, it needs to be copied. ProcessAttributeBuffer(uint64 offset,enum DwarfAttribute attr,enum DwarfForm form,const char * data,uint64 len)380 virtual void ProcessAttributeBuffer(uint64 offset, 381 enum DwarfAttribute attr, 382 enum DwarfForm form, 383 const char* data, 384 uint64 len) { } 385 386 // Called when we have an attribute with string data to give to 387 // our handler. The attribute is for the DIE at OFFSET from the 388 // beginning of compilation unit, has a name of ATTR, a form of 389 // FORM, and the actual data of the attribute is in DATA. ProcessAttributeString(uint64 offset,enum DwarfAttribute attr,enum DwarfForm form,const string & data)390 virtual void ProcessAttributeString(uint64 offset, 391 enum DwarfAttribute attr, 392 enum DwarfForm form, 393 const string& data) { } 394 395 // Called when finished processing the DIE at OFFSET. 396 // Because DWARF2/3 specifies a tree of DIEs, you may get starts 397 // before ends of the previous DIE, as we process children before 398 // ending the parent. EndDIE(uint64 offset)399 virtual void EndDIE(uint64 offset) { } 400 401 }; 402 403 // This class is a reader for DWARF's Call Frame Information. CFI 404 // describes how to unwind stack frames --- even for functions that do 405 // not follow fixed conventions for saving registers, whose frame size 406 // varies as they execute, etc. 407 // 408 // CFI describes, at each machine instruction, how to compute the 409 // stack frame's base address, how to find the return address, and 410 // where to find the saved values of the caller's registers (if the 411 // callee has stashed them somewhere to free up the registers for its 412 // own use). 413 // 414 // For example, suppose we have a function whose machine code looks 415 // like this (imagining an assembly language that looks like C, 32-bit 416 // registers, and a stack that grows towards lower addresses): 417 // 418 // func: ; entry point; return address at sp 419 // func+0: sp = sp - 16 ; allocate space for stack frame 420 // func+1: sp[12] = r0 ; save r0 at sp+12 421 // ... ; other code, not frame-related 422 // func+10: sp -= 4; *sp = x ; push some x on the stack 423 // ... ; other code, not frame-related 424 // func+20: r0 = sp[16] ; restore saved r0 425 // func+21: sp += 20 ; pop whole stack frame 426 // func+22: pc = *sp; sp += 4 ; pop return address and jump to it 427 // 428 // DWARF CFI is (a very compressed representation of) a table with a 429 // row for each machine instruction address and a column for each 430 // register showing how to restore it, if possible. A special column 431 // named "CFA", for "Call Frame Address", tells how to compute the 432 // base address of the frame; other entries may refer to the CFA. 433 // Another special column, named "RA", represents the return address. 434 // 435 // insn cfa r0 r1 ... ra 436 // ======================================= 437 // func+0: sp cfa[0] 438 // func+1: sp+16 cfa[0] 439 // func+2: sp+16 cfa[-4] cfa[0] 440 // func+11: sp+20 cfa[-4] cfa[0] 441 // func+21: sp+20 cfa[0] 442 // func+22: sp cfa[0] 443 // 444 // Some things to note here: 445 // 446 // - Each row describes the state of affairs *before* executing the 447 // instruction at the given address. Thus, the row for func+0 448 // describes the state before we allocate the stack frame. In the 449 // next row, the formula for computing the CFA has changed, 450 // reflecting that allocation. 451 // 452 // - The other entries are written in terms of the CFA; this allows 453 // them to remain unchanged as the stack pointer gets bumped around. 454 // For example, to find the caller's value of r0 at func+2, we would 455 // first compute the CFA by adding 16 to the sp, and then subtract 456 // four from that to find the address of saved value of r0. 457 // 458 // - Although we haven't shown it, most calling conventions designate 459 // "callee-saves" and "caller-saves" registers. The callee must 460 // preserve the values of callee-saves registers; if it uses them, 461 // it must save their original values somewhere, and restore them 462 // before it returns. In contrast, the callee is free to trash 463 // caller-saves registers; if the callee uses these, it will 464 // probably not bother to save them anywhere, and the CFI will 465 // probably mark their values as "unrecoverable". 466 // 467 // - Exactly where the CFA points is a matter of convention that 468 // depends on the architecture and ABI in use. Perhaps it points at 469 // the return address, perhaps elsewhere. But by definition, the 470 // CFA remains constant throughout the lifetime of the frame. This 471 // makes it a useful value for other columns to refer to. 472 // 473 // If you look at the table above, you'll notice that a given entry is 474 // often the same as the one immediately above it: most instructions 475 // change only one or two aspects of the stack frame, if they affect 476 // it at all. In the actual DWARF data, we take advantage of this 477 // fact, and compress the representation of the table by mentioning 478 // only the addresses and columns at which changes take place. So for 479 // the above, the DWARF CFI data would only actually mention the 480 // following: 481 // 482 // insn cfa r0 r1 ... ra 483 // ======================================= 484 // func+0: sp cfa[0] 485 // func+1: sp+16 486 // func+2: cfa[-4] 487 // func+11: sp+20 488 // func+21: r0 489 // func+22: sp 490 // 491 // In fact, this is the way the parser reports CFI to the consumer: as 492 // a series of statements of the form, "At address X, column Y changed 493 // to Z," and related conventions for describing the initial state. 494 // 495 // Naturally, it would be impractical to have to scan the entire 496 // program's CFI just to recover one instruction's unwinding rules, so 497 // the CFI data is typically grouped into entries, each covering a 498 // single function, which begin with a complete statement of the rules 499 // for all recoverable registers. 500 // 501 // Thus, to compute the contents of a given row of the table --- that 502 // is, rules for recovering the CFA, RA, and registers at a given 503 // instruction --- the consumer should start at the the initial state 504 // supplied at the beginning of the entry, and work forward until it 505 // has processed all the changes up to and including those for the 506 // present instruction. 507 // 508 // There are three kinds of values that can appear in an entry of the 509 // table: 510 // 511 // - "undefined": The given register is not preserved by the callee; 512 // its value cannot be recovered. 513 // 514 // - "same value": This register has the same value it did in the callee. 515 // 516 // - EXPRESSION: Evaluating the given expression yields the register's 517 // value. We represent expressions in the little postfix language 518 // used by Breakpad, described in the comments in file 519 // src/processor/postfix_evaluator.h. 520 521 class CallFrameInfo { 522 523 // Create a DWARF CFI parser. BUFFER points to the contents of the 524 // .debug_frame section to parse; BUFFER_LENGTH is its length in 525 // bytes. Reader is a ByteReader instance that has the endianness 526 // set properly. Report the data we find to HANDLER. Use 527 // REGISTER_NAMES[R] as the name of register number R in the postfix 528 // expressions we pass to HANDLER. CallFrameInfo(const uint8 * buffer,size_t buffer_length,const vector<const string> & register_names,CallFrameInfoHandler * handler)529 CallFrameInfo(const uint8 *buffer, size_t buffer_length, 530 const vector<const string> ®ister_names, 531 CallFrameInfoHandler *handler): 532 buffer_(buffer), 533 buffer_length_(buffer_length), 534 register_names_(register_names), 535 handler_(handler) { } 536 ~CallFrameInfo(); 537 538 // Parse the entries in BUFFER, reporting what we find to HANDLER. 539 // Return true if we reach the end of the section successfully, or 540 // false if we encounter an error. 541 bool Start(); 542 543 private: 544 545 // The contents of the DWARF .debug_info section we're parsing. 546 const uint8 *buffer_; 547 size_t buffer_length_; 548 549 // The names we should use to refer to registers in postfix expressions. 550 const vector<const string> ®ister_names_; 551 552 // The handler to which we should report the data we find. 553 CallFrameInfoHandler *handler_; 554 }; 555 556 // The handler class for CallFrameInfo. The a CFI parser calls the 557 // member functions of a handler object to report the data it finds. 558 class CallFrameInfoHandler { CallFrameInfoHandler()559 CallFrameInfoHandler() {} 560 virtual ~CallFrameInfoHandler(); 561 562 // The parser has found CFI for the machine code at ADDRESS, 563 // extending for LENGTH bytes. VERSION is the version number of the 564 // CFI format. AUGMENTATION is a string describing any 565 // producer-specific extensions present in the data. RETURN_ADDRESS 566 // is the number of the register that holds the address to which the 567 // function should return. 568 // 569 // Entry should return true to process this CFI, or false to skip to 570 // the next entry. 571 // 572 // The parser invokes Entry for each Frame Description Entry (FDE) 573 // it finds. The parser doesn't report Common Information Entries 574 // to the handler explicitly; instead, if the handler elects to 575 // process a given FDE, the parser reiterates the appropriate CIE's 576 // contents at the beginning of the FDE's rules. 577 virtual bool Entry(uint64 address, uint64 length, uint8 version, 578 const char *augmentation, int return_address) = 0; 579 580 // When the Entry function returns true, the parser calls this 581 // handler function repeatedly to describe the rules for recovering 582 // registers at each instruction in the given range of machine code. 583 // Immediately after a call to Entry, the handler should assume that 584 // the rule for each register is "undefined" --- that is, that the 585 // register's value cannot be recovered. 586 // 587 // At ADDRESS, use RULE to recover register number COLUMN. RULE is 588 // either: 589 // 590 // - the string "undefined", meaning that value of the register in the 591 // caller cannot be recovered at this point, 592 // 593 // - the string "same", meaning that the callee has not changed the 594 // value of the register, and it still holds the value it had in 595 // the caller, or 596 // 597 // - a postfix expression that computes the value of the register. 598 // This expression may refer to the CFA using the identifier 599 // "$cfa", and may refer to other registers using the names 600 // provided by the RegisterName member function, below. 601 // 602 // Rule should return true if everything is okay, or false if 603 // an error occurs and parsing should stop. 604 virtual bool Rule(uint64 address, int column, const string &rule) = 0; 605 }; 606 607 } // namespace dwarf2reader 608 609 #endif // UTIL_DEBUGINFO_DWARF2READER_H__ 610