diff options
author | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-03-11 22:16:12 +0000 |
---|---|---|
committer | jimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-03-11 22:16:12 +0000 |
commit | fd18beeb5c817aa3ecdb21caceee8e6ce08c6ab3 (patch) | |
tree | 5997c04fe096f9b15bbe388af5c7fdd2c466cdc9 /src/common/dwarf_cu_to_module.cc | |
parent | Put PUBLIC lines in Mac symbol files. (diff) | |
download | breakpad-fd18beeb5c817aa3ecdb21caceee8e6ce08c6ab3.tar.xz |
Google Breakpad Issue 417: Handle DWARF that omits function names.
This patch makes sure dump_syms behaves properly when presented with
malformed DWARF data that provides no name for a function. We print a
warning message to stderr, and subsitute "<name omitted>" for the empty
string, so that the "FUNC" record written to the symbol file for the
function is still well-formed. (We may have line number data covering the
function, so it would be a shame to omit the function altogether.)
Unit tests included.
a=jimblandy, r=ted.mielczarek
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@779 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf_cu_to_module.cc')
-rw-r--r-- | src/common/dwarf_cu_to_module.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index 425fd332..1922066a 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -428,7 +428,14 @@ void DwarfCUToModule::FuncHandler::Finish() { // Create a Module::Function based on the data we've gathered, and // add it to the functions_ list. Module::Function *func = new Module::Function; - func->name = name_; + // Malformed DWARF may omit the name, but all Module::Functions must + // have names. + if (!name_.empty()) { + func->name = name_; + } else { + cu_context_->reporter->UnnamedFunction(offset_); + func->name = "<name omitted>"; + } func->address = low_pc_; func->size = high_pc_ - low_pc_; func->parameter_size = 0; @@ -543,6 +550,12 @@ void DwarfCUToModule::WarningReporter::UncoveredLine(const Module::Line &line) { line.file->name.c_str(), line.number, line.address); } +void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64 offset) { + CUHeading(); + fprintf(stderr, "%s: warning: function at offset 0x%" PRIx64 " has no name\n", + filename_.c_str(), offset); +} + DwarfCUToModule::DwarfCUToModule(FileContext *file_context, LineToModuleFunctor *line_reader, WarningReporter *reporter) |