aboutsummaryrefslogtreecommitdiff
path: root/src/common/test_assembler.cc
diff options
context:
space:
mode:
authorjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-05-05 17:09:20 +0000
committerjimblandy <jimblandy@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-05-05 17:09:20 +0000
commitb0ec96cee2ab186c9e7e480d03751588f0640bf1 (patch)
tree40fc8df4fbbf5542c27cad2919c025fe3881457f /src/common/test_assembler.cc
parentBreakpad symbol dumper: Define the ByteBuffer and ByteCursor classes. (diff)
downloadbreakpad-b0ec96cee2ab186c9e7e480d03751588f0640bf1.tar.xz
Breakpad Linux dumper: Make StabsReader independent of endianness and word size.
StabsReader simply applies a reinterpret_cast to treat the stab entry data as an array of 'struct nlist' structures, making the parser specific on the host endianness, word size, and alignment rules. On Mac OS X, a single fat binary file may contain object files of different ABIs, of which the user chooses one at run time. This patch changes the parser to read the data using the google_breakpad:: ByteCursor class, which can handle different endiannesses and word sizes. The StabsReader constructor now takes arguments indicating the endianness of the data and the size of each entry's value field. The patch changes src/common/linux/dump_symbols.cc to pass the new argument. This patch changes the StabsReader unit tests to use the google_breakpad:: TestAssembler classes to generate test data, rather than reading it from a file. This makes it easy to generate test data in various endiannesses and word sizes. It also adds tests for the new parser behaviors. a=jimblandy, r=thestig git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@583 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/test_assembler.cc')
-rw-r--r--src/common/test_assembler.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/test_assembler.cc b/src/common/test_assembler.cc
index 3fd7cad0..54092f37 100644
--- a/src/common/test_assembler.cc
+++ b/src/common/test_assembler.cc
@@ -203,6 +203,7 @@ void Label::Binding::Get(Binding **base, u_int64_t *addend) {
template<typename Inserter>
static inline void InsertEndian(TestAssembler::Endianness endianness,
size_t size, u_int64_t number, Inserter dest) {
+ assert(size > 0);
if (endianness == kLittleEndian) {
for (size_t i = 0; i < size; i++) {
*dest++ = (char) (number & 0xff);