From e15bffe46696996d13ce308a8dbd52a919150ba6 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Fri, 22 Jan 2010 23:26:12 +0000 Subject: Breakpad DWARF Reader: Also look for DWARF in sections with the proper names. The DWARF specification specifices which names the sections containing DWARF information should have. OSX uses slightly different names. This patch changes the DWARF reader to look for the sections under both sets of names. a=jimblandy, r=ccoutant git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@493 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/dwarf/dwarf2reader.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/common/dwarf/dwarf2reader.cc') diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index 77c318fa..357029c2 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -79,8 +79,12 @@ void CompilationUnit::ReadAbbrevs() { if (abbrevs_) return; - // First get the debug_abbrev section - SectionMap::const_iterator iter = sections_.find("__debug_abbrev"); + // First get the debug_abbrev section. ".debug_abbrev" is the name + // recommended in the DWARF spec, and used on Linux; + // "__debug_abbrev" is the name used in Mac OS X Mach-O files. + SectionMap::const_iterator iter = sections_.find(".debug_abbrev"); + if (iter == sections_.end()) + iter = sections_.find("__debug_abbrev"); assert(iter != sections_.end()); abbrevs_ = new vector; @@ -267,8 +271,12 @@ void CompilationUnit::ReadHeader() { } uint64 CompilationUnit::Start() { - // First get the debug_info section - SectionMap::const_iterator iter = sections_.find("__debug_info"); + // First get the debug_info section. ".debug_info" is the name + // recommended in the DWARF spec, and used on Linux; "__debug_info" + // is the name used in Mac OS X Mach-O files. + SectionMap::const_iterator iter = sections_.find(".debug_info"); + if (iter == sections_.end()) + iter = sections_.find("__debug_info"); assert(iter != sections_.end()); // Set up our buffer @@ -298,8 +306,12 @@ uint64 CompilationUnit::Start() { // Otherwise, continue by reading our abbreviation entries. ReadAbbrevs(); - // Set the string section if we have one. - iter = sections_.find("__debug_str"); + // Set the string section if we have one. ".debug_str" is the name + // recommended in the DWARF spec, and used on Linux; "__debug_str" + // is the name used in Mac OS X Mach-O files. + iter = sections_.find(".debug_str"); + if (iter == sections_.end()) + iter = sections_.find("__debug_str"); if (iter != sections_.end()) { string_buffer_ = iter->second.first; string_buffer_length_ = iter->second.second; -- cgit v1.2.1