aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf/dwarf2reader.cc
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-01-22 23:26:12 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-01-22 23:26:12 +0000
commite15bffe46696996d13ce308a8dbd52a919150ba6 (patch)
tree9e6fd3225e841c42450c56302585d5e79aa5c413 /src/common/dwarf/dwarf2reader.cc
parentAdd new file missed in r490. (diff)
downloadbreakpad-e15bffe46696996d13ce308a8dbd52a919150ba6.tar.xz
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
Diffstat (limited to 'src/common/dwarf/dwarf2reader.cc')
-rw-r--r--src/common/dwarf/dwarf2reader.cc24
1 files changed, 18 insertions, 6 deletions
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<Abbrev>;
@@ -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;