aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/linux/dump_symbols.cc8
-rw-r--r--src/common/stabs_to_module.cc (renamed from src/common/dump_stabs.cc)32
-rw-r--r--src/common/stabs_to_module.h (renamed from src/common/dump_stabs.h)12
-rw-r--r--src/common/stabs_to_module_unittest.cc (renamed from src/common/dump_stabs_unittest.cc)16
-rw-r--r--src/tools/linux/dump_syms/Makefile37
5 files changed, 53 insertions, 52 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index da4263f7..ec689ec6 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -48,23 +48,23 @@
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/dwarf2diehandler.h"
-#include "common/dump_stabs.h"
-#include "common/linux/dump_symbols.h"
#include "common/dwarf_cfi_to_module.h"
#include "common/dwarf_cu_to_module.h"
#include "common/dwarf_line_to_module.h"
+#include "common/linux/dump_symbols.h"
#include "common/linux/file_id.h"
#include "common/module.h"
#include "common/stabs_reader.h"
+#include "common/stabs_to_module.h"
// This namespace contains helper functions.
namespace {
-using google_breakpad::DumpStabsHandler;
using google_breakpad::DwarfCFIToModule;
using google_breakpad::DwarfCUToModule;
using google_breakpad::DwarfLineToModule;
using google_breakpad::Module;
+using google_breakpad::StabsToModule;
// Fix offset into virtual address by adding the mapped base into offsets.
// Make life easier when want to find something by offset.
@@ -139,7 +139,7 @@ static bool LoadStabs(const ElfW(Ehdr) *elf_header,
return false;
}
// A callback object to handle data from the STABS reader.
- DumpStabsHandler handler(module);
+ 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.
diff --git a/src/common/dump_stabs.cc b/src/common/stabs_to_module.cc
index e4ae1e1b..858d0dff 100644
--- a/src/common/dump_stabs.cc
+++ b/src/common/stabs_to_module.cc
@@ -29,15 +29,15 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
-// dump_stabs.cc --- implement the DumpStabsHandler class.
+// dump_stabs.cc --- implement the StabsToModule class.
-#include <cstdarg>
+#include <assert.h>
#include <cxxabi.h>
+#include <stdarg.h>
#include <algorithm>
-#include <cassert>
-#include "common/dump_stabs.h"
+#include "common/stabs_to_module.h"
namespace google_breakpad {
@@ -56,7 +56,7 @@ static string Demangle(const string &mangled) {
return string(mangled);
}
-DumpStabsHandler::~DumpStabsHandler() {
+StabsToModule::~StabsToModule() {
// Free any functions we've accumulated but not added to the module.
for (vector<Module::Function *>::iterator func_it = functions_.begin();
func_it != functions_.end(); func_it++)
@@ -65,8 +65,8 @@ DumpStabsHandler::~DumpStabsHandler() {
delete current_function_;
}
-bool DumpStabsHandler::StartCompilationUnit(const char *name, uint64_t address,
- const char *build_directory) {
+bool StabsToModule::StartCompilationUnit(const char *name, uint64_t address,
+ const char *build_directory) {
assert(!in_compilation_unit_);
in_compilation_unit_ = true;
current_source_file_name_ = name;
@@ -76,7 +76,7 @@ bool DumpStabsHandler::StartCompilationUnit(const char *name, uint64_t address,
return true;
}
-bool DumpStabsHandler::EndCompilationUnit(uint64_t address) {
+bool StabsToModule::EndCompilationUnit(uint64_t address) {
assert(in_compilation_unit_);
in_compilation_unit_ = false;
comp_unit_base_address_ = 0;
@@ -87,20 +87,20 @@ bool DumpStabsHandler::EndCompilationUnit(uint64_t address) {
return true;
}
-bool DumpStabsHandler::StartFunction(const string &name,
- uint64_t address) {
+bool StabsToModule::StartFunction(const string &name,
+ uint64_t address) {
assert(!current_function_);
Module::Function *f = new Module::Function;
f->name = Demangle(name);
f->address = address;
- f->size = 0; // We compute this in DumpStabsHandler::Finalize().
+ f->size = 0; // We compute this in StabsToModule::Finalize().
f->parameter_size = 0; // We don't provide this information.
current_function_ = f;
boundaries_.push_back(static_cast<Module::Address>(address));
return true;
}
-bool DumpStabsHandler::EndFunction(uint64_t address) {
+bool StabsToModule::EndFunction(uint64_t address) {
assert(current_function_);
// Functions in this compilation unit should have address bigger
// than the compilation unit's starting address. There may be a lot
@@ -120,7 +120,7 @@ bool DumpStabsHandler::EndFunction(uint64_t address) {
return true;
}
-bool DumpStabsHandler::Line(uint64_t address, const char *name, int number) {
+bool StabsToModule::Line(uint64_t address, const char *name, int number) {
assert(current_function_);
assert(current_source_file_);
if (name != current_source_file_name_) {
@@ -129,21 +129,21 @@ bool DumpStabsHandler::Line(uint64_t address, const char *name, int number) {
}
Module::Line line;
line.address = address;
- line.size = 0; // We compute this in DumpStabsHandler::Finalize().
+ line.size = 0; // We compute this in StabsToModule::Finalize().
line.file = current_source_file_;
line.number = number;
current_function_->lines.push_back(line);
return true;
}
-void DumpStabsHandler::Warning(const char *format, ...) {
+void StabsToModule::Warning(const char *format, ...) {
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
}
-void DumpStabsHandler::Finalize() {
+void StabsToModule::Finalize() {
// Sort our boundary list, so we can search it quickly.
sort(boundaries_.begin(), boundaries_.end());
// Sort all functions by address, just for neatness.
diff --git a/src/common/dump_stabs.h b/src/common/stabs_to_module.h
index 36d773e8..6538d78d 100644
--- a/src/common/dump_stabs.h
+++ b/src/common/stabs_to_module.h
@@ -31,7 +31,7 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
-// dump_stabs.h: Define the DumpStabsHandler class, which receives
+// dump_stabs.h: Define the StabsToModule class, which receives
// STABS debugging information from a parser and adds it to a Breakpad
// symbol file.
@@ -51,24 +51,24 @@ namespace google_breakpad {
using std::string;
using std::vector;
-// A DumpStabsHandler is a handler that receives parsed STABS
+// A StabsToModule is a handler that receives parsed STABS
// debugging information from a StabsReader, and uses that to populate
// a Module. (All classes are in the google_breakpad namespace.) A
// Module represents the contents of a Breakpad symbol file, and knows
-// how to write itself out as such. A DumpStabsHandler thus acts as
+// how to write itself out as such. A StabsToModule thus acts as
// the bridge between STABS and Breakpad data.
-class DumpStabsHandler: public google_breakpad::StabsHandler {
+class StabsToModule: public google_breakpad::StabsHandler {
public:
// Receive parsed debugging information from a StabsReader, and
// store it all in MODULE.
- DumpStabsHandler(Module *module) :
+ StabsToModule(Module *module) :
module_(module),
in_compilation_unit_(false),
comp_unit_base_address_(0),
current_function_(NULL),
current_source_file_(NULL),
current_source_file_name_(NULL) { }
- ~DumpStabsHandler();
+ ~StabsToModule();
// The standard StabsHandler virtual member functions.
bool StartCompilationUnit(const char *name, uint64_t address,
diff --git a/src/common/dump_stabs_unittest.cc b/src/common/stabs_to_module_unittest.cc
index 7d27cb88..4248b3c0 100644
--- a/src/common/dump_stabs_unittest.cc
+++ b/src/common/stabs_to_module_unittest.cc
@@ -29,20 +29,20 @@
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
-// dump_stabs_unittest.cc: Unit tests for DumpStabsHandler.
+// dump_stabs_unittest.cc: Unit tests for StabsToModule.
#include <vector>
#include "breakpad_googletest_includes.h"
-#include "common/dump_stabs.h"
+#include "common/stabs_to_module.h"
-using google_breakpad::DumpStabsHandler;
using google_breakpad::Module;
+using google_breakpad::StabsToModule;
using std::vector;
-TEST(DumpStabsHandler, SimpleCU) {
+TEST(StabsToModule, SimpleCU) {
Module m("name", "os", "arch", "id");
- DumpStabsHandler h(&m);
+ StabsToModule h(&m);
// Feed in a simple compilation unit that defines a function with
// one line.
@@ -76,7 +76,7 @@ TEST(DumpStabsHandler, SimpleCU) {
TEST(InferSizes, LineSize) {
Module m("name", "os", "arch", "id");
- DumpStabsHandler h(&m);
+ StabsToModule h(&m);
// Feed in a simple compilation unit that defines a function with
// one line.
@@ -124,7 +124,7 @@ TEST(InferSizes, LineSize) {
TEST(FunctionNames, Mangled) {
Module m("name", "os", "arch", "id");
- DumpStabsHandler h(&m);
+ StabsToModule h(&m);
// Compilation unit with one function, mangled name.
EXPECT_TRUE(h.StartCompilationUnit("compilation-unit", 0xf2cfda63cef7f46cLL,
@@ -163,7 +163,7 @@ TEST(FunctionNames, Mangled) {
// SO addresses are zero.
TEST(Omitted, Function) {
Module m("name", "os", "arch", "id");
- DumpStabsHandler h(&m);
+ StabsToModule h(&m);
// The StartCompilationUnit and EndCompilationUnit calls may both have an
// address of zero if the compilation unit has had sections removed.
diff --git a/src/tools/linux/dump_syms/Makefile b/src/tools/linux/dump_syms/Makefile
index 800e3add..17f94722 100644
--- a/src/tools/linux/dump_syms/Makefile
+++ b/src/tools/linux/dump_syms/Makefile
@@ -77,18 +77,18 @@ COVERAGE_SOURCES =
all:: dump_syms
dump_syms: \
bytereader.o \
- dwarf_cfi_to_module.o \
- dwarf_cu_to_module.o \
- dwarf_line_to_module.o \
- dump_stabs.o \
dump_symbols.o \
dump_syms.o \
dwarf2diehandler.o \
dwarf2reader.o \
+ dwarf_cfi_to_module.o \
+ dwarf_cu_to_module.o \
+ dwarf_line_to_module.o \
file_id.o \
language.o \
module.o \
stabs_reader.o \
+ stabs_to_module.o \
$(empty)
CPP_EXECUTABLES += dump_syms
clean::
@@ -103,13 +103,13 @@ dwarf_cu_to_module.o: dwarf_cu_to_module.cc
COVERAGE_SOURCES += dwarf_cu_to_module.cc
dwarf_line_to_module.o: dwarf_line_to_module.cc
COVERAGE_SOURCES += dwarf_line_to_module.cc
-dump_stabs.o: dump_stabs.cc
-COVERAGE_SOURCES += dump_stabs.cc
language.o: language.cc
module.o: module.cc
COVERAGE_SOURCES += module.cc
stabs_reader.o: stabs_reader.cc
COVERAGE_SOURCES += stabs_reader.cc
+stabs_to_module.o: stabs_to_module.cc
+COVERAGE_SOURCES += stabs_to_module.cc
VPATH += $(SRC)/common/linux
dump_symbols.o: dump_symbols.cc
@@ -167,10 +167,10 @@ clean::
check: check-file_id_unittest
check-file_id_unittest: file_id_unittest
file_id_unittest: \
+ file_id.o \
gmock-all.o \
gtest-all.o \
gtest_main.o \
- file_id.o \
$(empty)
CPP_EXECUTABLES += file_id_unittest
file_id_unittest.o: file_id_unittest.cc
@@ -198,30 +198,31 @@ clean::
### Unit tests for google_breakpad::DumpStabsHandler.
-check: check-dump_stabs_unittest
-check-dump_stabs_unittest: dump_stabs_unittest
-dump_stabs_unittest: \
+check: check-stabs_to_module_unittest
+check-stabs_to_module_unittest: stabs_to_module_unittest
+stabs_to_module_unittest: \
gtest-all.o \
gtest_main.o \
- dump_stabs.o \
- dump_stabs_unittest.o \
module.o \
+ stabs_to_module.o \
+ stabs_to_module_unittest.o \
$(empty)
-CPP_EXECUTABLES += dump_stabs_unittest
-dump_stabs_unittest.o: dump_stabs_unittest.cc
-dump_stabs_unittest.o: override CPPFLAGS += $(GTEST_CPPFLAGS) $(GMOCK_CPPFLAGS)
+CPP_EXECUTABLES += stabs_to_module_unittest
+stabs_to_module_unittest.o: stabs_to_module_unittest.cc
+stabs_to_module_unittest.o: override CPPFLAGS += $(GTEST_CPPFLAGS) \
+ $(GMOCK_CPPFLAGS)
clean::
- rm -f dump_stabs_unittest
+ rm -f stabs_to_module_unittest
### Unit tests for dwarf2reader::DwarfDIEDispatcher.
check: check-dwarf2diehandler_unittest
check-dwarf2diehandler_unittest: dwarf2diehandler_unittest
dwarf2diehandler_unittest: \
+ dwarf2diehandler.o \
gmock-all.o \
gtest-all.o \
gtest_main.o \
- dwarf2diehandler.o \
$(empty)
CPP_EXECUTABLES += dwarf2diehandler_unittest
dwarf2diehandler_unittest.o: dwarf2diehandler_unittest.cc
@@ -236,10 +237,10 @@ clean::
check: check-dwarf_line_to_module_unittest
check-dwarf_line_to_module_unittest: dwarf_line_to_module_unittest
dwarf_line_to_module_unittest: \
+ dwarf_line_to_module.o \
gtest-all.o \
gtest_main.o \
module.o \
- dwarf_line_to_module.o \
$(empty)
CPP_EXECUTABLES += dwarf_line_to_module_unittest
dwarf_line_to_module_unittest.o: dwarf_line_to_module_unittest.cc