Breakpad Mac symbol dumper: Add new Mach-O reader class.

This patch adds files defining new classes in the google_breakpad::Mach_O
namespace for parsing fat binaries and Mach-O files. These are used in the
new dumper to handle STABS debugging information, DWARF call frame
information, and .eh_frame exception handling stack walking information.

These new classes are independent of endianness and word size, and
therefore can be used on binaries of all the relevant architectures: x86,
x86_64, ppc, and ARM.

The patch adds a complete set of unit tests for the new classes.
A=jimb R=mark (http://breakpad.appspot.com/93001/show, http://breakpad.appspot.com/115001/show)

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@610 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek
2010-06-25 16:56:16 +00:00
parent 8ffb12eb35
commit 35c41e00ee
11 changed files with 3306 additions and 31 deletions

View File

@@ -32,14 +32,15 @@
// test_assembler.cc: Implementation of google_breakpad::TestAssembler.
// See test_assembler.h for details.
#include <cassert>
#include <cstdio>
#include <assert.h>
#include <stdio.h>
#include <iterator>
#include "common/test_assembler.h"
namespace google_breakpad {
namespace TestAssembler {
namespace test_assembler {
using std::back_insert_iterator;
@@ -201,7 +202,7 @@ void Label::Binding::Get(Binding **base, u_int64_t *addend) {
}
template<typename Inserter>
static inline void InsertEndian(TestAssembler::Endianness endianness,
static inline void InsertEndian(test_assembler::Endianness endianness,
size_t size, u_int64_t number, Inserter dest) {
assert(size > 0);
if (endianness == kLittleEndian) {
@@ -341,7 +342,7 @@ bool Section::GetContents(string *contents) {
Reference &r = references_[i];
u_int64_t value;
if (!r.label.IsKnownConstant(&value)) {
fprintf(stderr, "Undefined label #%d at offset 0x%x\n", i, r.offset);
fprintf(stderr, "Undefined label #%zu at offset 0x%zx\n", i, r.offset);
return false;
}
assert(r.offset < contents_.size());
@@ -354,5 +355,5 @@ bool Section::GetContents(string *contents) {
return true;
}
} // namespace TestAssembler
} // namespace google_breakpad
} // namespace test_assembler
} // namespace google_breakpad