From 775c6f7640a02841b667fd6300e877bbed574544 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 5 May 2010 17:34:19 +0000 Subject: Breakpad Linux dumper: Handle STABS-in-symbol-table, and line number records outside functions. This patch addresses two differences between Linux and Macintosh OS X STABS data: - StabsReader assumes that the STABS entries follow the conventions for storing STABS data in object file sections (that is, .stabs and .stabstr), rather than in the object files's linker symbol table. On Mac OS X, STABS entries live in the Mach-O file's LC_SYMTAB load command, along with all the other linker symbols; they are not grouped into units by N_UNDF entries. This patch adds a boolean argument to the StabsReader constructor indicating whether the parser should treat N_UNDF entries as unit boundaries; this argument should be true on Linux, and false on Mac. The patch changes src/common/linux/dump_symbols.cc to pass this new argument. - Mac OS X STABS place SLINE (line number) records immediately before the FUN record for the function to which they belong, and the values of such records are absolute, not relative to the function start. This patch extends the parser to queue up such records and report them to the handler when we do see the FUN record. The meaning of StabsHandler::Line remains unchanged; existing handlers do not need to be adjusted. This patch also adds unit tests for the new parser behaviors. a=jimblandy, r=mark git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@587 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/dump_symbols.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/common/linux') diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index ec689ec6..900385e1 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -142,12 +142,13 @@ static bool LoadStabs(const ElfW(Ehdr) *elf_header, StabsToModule handler(module); // Find the addresses of the STABS data, and create a STABS reader object. // On Linux, STABS entries always have 32-bit values, regardless of the - // address size of the architecture whose code they're describing. + // address size of the architecture whose code they're describing, and + // the strings are always "unitized". uint8_t *stabs = reinterpret_cast(stab_section->sh_offset); uint8_t *stabstr = reinterpret_cast(stabstr_section->sh_offset); google_breakpad::StabsReader reader(stabs, stab_section->sh_size, stabstr, stabstr_section->sh_size, - big_endian, 4, &handler); + big_endian, 4, true, &handler); // Read the STABS data, and do post-processing. if (!reader.Process()) return false; -- cgit v1.2.1