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
This commit is contained in:
jimblandy 2010-01-22 23:26:12 +00:00
parent f4a106d4b5
commit e15bffe466

View File

@ -79,8 +79,12 @@ void CompilationUnit::ReadAbbrevs() {
if (abbrevs_) if (abbrevs_)
return; return;
// First get the debug_abbrev section // First get the debug_abbrev section. ".debug_abbrev" is the name
SectionMap::const_iterator iter = sections_.find("__debug_abbrev"); // 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()); assert(iter != sections_.end());
abbrevs_ = new vector<Abbrev>; abbrevs_ = new vector<Abbrev>;
@ -267,8 +271,12 @@ void CompilationUnit::ReadHeader() {
} }
uint64 CompilationUnit::Start() { uint64 CompilationUnit::Start() {
// First get the debug_info section // First get the debug_info section. ".debug_info" is the name
SectionMap::const_iterator iter = sections_.find("__debug_info"); // 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()); assert(iter != sections_.end());
// Set up our buffer // Set up our buffer
@ -298,8 +306,12 @@ uint64 CompilationUnit::Start() {
// Otherwise, continue by reading our abbreviation entries. // Otherwise, continue by reading our abbreviation entries.
ReadAbbrevs(); ReadAbbrevs();
// Set the string section if we have one. // Set the string section if we have one. ".debug_str" is the name
iter = sections_.find("__debug_str"); // 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()) { if (iter != sections_.end()) {
string_buffer_ = iter->second.first; string_buffer_ = iter->second.first;
string_buffer_length_ = iter->second.second; string_buffer_length_ = iter->second.second;