diff options
author | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-01-12 16:53:02 +0000 |
---|---|---|
committer | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-01-12 16:53:02 +0000 |
commit | 330ca2f7c71d84a01626b1198ef600540eb320b8 (patch) | |
tree | b5531f2281c297c2c5d9b2372296af1632592df4 /src/common/dwarf/functioninfo.cc | |
parent | Breakpad: Avoid warnings building with G++ 4.4.1 using -O3 -Wall. (diff) | |
download | breakpad-330ca2f7c71d84a01626b1198ef600540eb320b8.tar.xz |
Google Breakpad DWARF reader: Add a handler function for DIE references.
Add a new member function to dwarf2reader::Dwarf2Handler,
ProcessAttributeReference, for reporting attribute values that are
references to other DIEs. This handler member function always receives
an absolute offset (that is, relative to the start of the .debug_info
section, not to the start of the compilation unit), regardless of the
form the attribute uses. (Some forms are CU-relative, some are
absolute.)
a=jimblandy, r=nealsid
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@482 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf/functioninfo.cc')
-rw-r--r-- | src/common/dwarf/functioninfo.cc | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/common/dwarf/functioninfo.cc b/src/common/dwarf/functioninfo.cc index 1957153e..09aa01fd 100644 --- a/src/common/dwarf/functioninfo.cc +++ b/src/common/dwarf/functioninfo.cc @@ -42,25 +42,6 @@ namespace dwarf2reader { -// Given an offset value, its form, and the base offset of the -// compilation unit containing this value, return an absolute offset -// within the .debug_info section. -uint64 GetAbsoluteOffset(uint64 offset, - enum DwarfForm form, - uint64 compilation_unit_base) { - switch (form) { - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: - return offset + compilation_unit_base; - case DW_FORM_ref_addr: - default: - return offset; - } -} - CULineInfoHandler::CULineInfoHandler(vector<SourceFileInfo>* files, vector<string>* dirs, LineMap* linemap):linemap_(linemap), @@ -198,6 +179,18 @@ void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64 offset, case DW_AT_decl_file: current_function_info_->file = files_->at(data).name; break; + default: + break; + } + } +} + +void CUFunctionInfoHandler::ProcessAttributeReference(uint64 offset, + enum DwarfAttribute attr, + enum DwarfForm form, + uint64 data) { + if (current_function_info_) { + switch (attr) { case DW_AT_specification: { // Some functions have a "specification" attribute // which means they were defined elsewhere. The name @@ -205,14 +198,13 @@ void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64 offset, // the specification DIE. Here we'll assume that // any DIE referenced in this manner will already have // been seen, but that's not really required by the spec. - uint64 abs_offset = GetAbsoluteOffset(data, form, current_compilation_unit_offset_); - FunctionMap::iterator iter = offset_to_funcinfo_->find(abs_offset); + FunctionMap::iterator iter = offset_to_funcinfo_->find(data); if (iter != offset_to_funcinfo_->end()) { current_function_info_->name = iter->second->name; current_function_info_->mangled_name = iter->second->mangled_name; } else { // If you hit this, this code probably needs to be rewritten. - fprintf(stderr, "Error: DW_AT_specification was seen before the referenced DIE! (Looking for DIE at offset %08llx, in DIE at offset %08llx)\n", abs_offset, offset); + fprintf(stderr, "Error: DW_AT_specification was seen before the referenced DIE! (Looking for DIE at offset %08llx, in DIE at offset %08llx)\n", data, offset); } break; } |