aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-20 00:00:12 +0000
committerbryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-09-20 00:00:12 +0000
commit0170bea32f3b6745a924c04899d0dae563e078f6 (patch)
tree6922b9009d58429d5e855b42989815ebc4a5b346
parentGet rid of CrashReport, and rename CrashReportProcessor to MinidumpProcessor (diff)
downloadbreakpad-0170bea32f3b6745a924c04899d0dae563e078f6.tar.xz
Follow-up to #26: get rid of supplier_data, it's not really needed since
the caller can implement their own supplier object. r=mmentovai. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@27 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/google/minidump_processor.h6
-rw-r--r--src/google/symbol_supplier.h4
-rw-r--r--src/processor/minidump_processor.cc3
-rw-r--r--src/processor/minidump_processor_unittest.cc20
-rw-r--r--src/processor/minidump_stackwalk.cc2
-rw-r--r--src/processor/stackwalker.cc7
-rw-r--r--src/processor/stackwalker.h9
-rw-r--r--src/processor/stackwalker_x86.cc5
-rw-r--r--src/processor/stackwalker_x86.h3
9 files changed, 16 insertions, 43 deletions
diff --git a/src/google/minidump_processor.h b/src/google/minidump_processor.h
index 9c80ee4e..31b80090 100644
--- a/src/google/minidump_processor.h
+++ b/src/google/minidump_processor.h
@@ -32,10 +32,8 @@ class MinidumpProcessor {
~MinidumpProcessor();
// Fills in the given StackFrames vector by processing the minidump file.
- // supplier_data is an opaque pointer which is passed to
- // SymbolSupplier::GetSymbolFile(). Returns true on success.
- bool Process(const string &minidump_file, void *supplier_data,
- StackFrames *stack_frames);
+ // Returns true on success.
+ bool Process(const string &minidump_file, StackFrames *stack_frames);
private:
SymbolSupplier *supplier_;
diff --git a/src/google/symbol_supplier.h b/src/google/symbol_supplier.h
index f0a6e39c..74bddf7f 100644
--- a/src/google/symbol_supplier.h
+++ b/src/google/symbol_supplier.h
@@ -30,9 +30,7 @@ class SymbolSupplier {
virtual ~SymbolSupplier() {}
// Returns the path to the symbol file for the given module.
- // supplier_data is passed through from MinidumpProcessor::Process().
- virtual string GetSymbolFile(MinidumpModule *module,
- void *supplier_data) = 0;
+ virtual string GetSymbolFile(MinidumpModule *module) = 0;
};
} // namespace google_airbag
diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc
index 74e478a6..9b5f4c9f 100644
--- a/src/processor/minidump_processor.cc
+++ b/src/processor/minidump_processor.cc
@@ -26,7 +26,6 @@ MinidumpProcessor::~MinidumpProcessor() {
}
bool MinidumpProcessor::Process(const string &minidump_file,
- void *supplier_data,
StackFrames *stack_frames) {
Minidump dump(minidump_file);
if (!dump.Read()) {
@@ -56,7 +55,7 @@ bool MinidumpProcessor::Process(const string &minidump_file,
// TODO(bryner): figure out which StackWalker we want
StackwalkerX86 walker(exception->GetContext(), thread_memory,
- dump.GetModuleList(), supplier_, supplier_data);
+ dump.GetModuleList(), supplier_);
walker.Walk(stack_frames);
return true;
}
diff --git a/src/processor/minidump_processor_unittest.cc b/src/processor/minidump_processor_unittest.cc
index b73469b5..13a58662 100644
--- a/src/processor/minidump_processor_unittest.cc
+++ b/src/processor/minidump_processor_unittest.cc
@@ -36,22 +36,10 @@ namespace google_airbag {
class TestSymbolSupplier : public SymbolSupplier {
public:
- TestSymbolSupplier() : has_supplier_data_(false) {}
- virtual ~TestSymbolSupplier() {}
-
- virtual string GetSymbolFile(MinidumpModule *module, void *supplier_data);
-
- // This member is used to test the data argument to GetSymbolFile.
- // If the argument is correct, it's set to true.
- bool has_supplier_data_;
+ virtual string GetSymbolFile(MinidumpModule *module);
};
-string TestSymbolSupplier::GetSymbolFile(MinidumpModule *module,
- void *supplier_data) {
- if (supplier_data == &has_supplier_data_) {
- has_supplier_data_ = true;
- }
-
+string TestSymbolSupplier::GetSymbolFile(MinidumpModule *module) {
if (*(module->GetName()) == "c:\\test_app.exe") {
return string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata/minidump2.sym";
@@ -73,9 +61,7 @@ static bool RunTests() {
string minidump_file = string(getenv("srcdir") ? getenv("srcdir") : ".") +
"/src/processor/testdata/minidump2.dmp";
- ASSERT_TRUE(processor.Process(minidump_file,
- &supplier.has_supplier_data_, &stack_frames));
- ASSERT_TRUE(supplier.has_supplier_data_);
+ ASSERT_TRUE(processor.Process(minidump_file, &stack_frames));
ASSERT_EQ(stack_frames.size(), 4);
ASSERT_EQ(stack_frames[0].module_base, 0x400000);
diff --git a/src/processor/minidump_stackwalk.cc b/src/processor/minidump_stackwalk.cc
index b6049b8b..48ce1c51 100644
--- a/src/processor/minidump_stackwalk.cc
+++ b/src/processor/minidump_stackwalk.cc
@@ -80,7 +80,7 @@ int main(int argc, char** argv) {
}
StackwalkerX86 stackwalker = StackwalkerX86(context, stack_memory,
- modules, NULL, NULL);
+ modules, NULL);
StackFrames stack;
stackwalker.Walk(&stack);
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index 62386b83..69301515 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -34,11 +34,10 @@ using std::auto_ptr;
Stackwalker::Stackwalker(MemoryRegion* memory, MinidumpModuleList* modules,
- SymbolSupplier* supplier, void* supplier_data)
+ SymbolSupplier* supplier)
: memory_(memory),
modules_(modules),
- supplier_(supplier),
- supplier_data_(supplier_data) {
+ supplier_(supplier) {
}
@@ -65,7 +64,7 @@ void Stackwalker::Walk(StackFrames *frames) {
frame->module_base = module->base_address();
if (modules_ && supplier_) {
string symbol_file =
- supplier_->GetSymbolFile(module, supplier_data_);
+ supplier_->GetSymbolFile(module);
if (!symbol_file.empty()) {
resolver.LoadModule(*(module->GetName()), symbol_file);
resolver.FillSourceLineInfo(frame.get());
diff --git a/src/processor/stackwalker.h b/src/processor/stackwalker.h
index bfcb783a..1b1aed63 100644
--- a/src/processor/stackwalker.h
+++ b/src/processor/stackwalker.h
@@ -54,12 +54,10 @@ class Stackwalker {
// that is used to look up which code module each stack frame is
// associated with. supplier is an optional caller-supplied SymbolSupplier
// implementation. If supplier is NULL, source line info will not be
- // resolved. supplier_data will be passed to the SymbolSupplier's
- // GetSymbolFile method.
+ // resolved.
Stackwalker(MemoryRegion* memory,
MinidumpModuleList* modules,
- SymbolSupplier* supplier,
- void* supplier_data);
+ SymbolSupplier* supplier);
// The stack memory to walk. Subclasses will require this region to
// get information from the stack.
@@ -83,9 +81,6 @@ class Stackwalker {
// The optional SymbolSupplier for resolving source line info.
SymbolSupplier* supplier_;
-
- // Caller-supplied data to be passed to the symbol supplier
- void* supplier_data_;
};
diff --git a/src/processor/stackwalker_x86.cc b/src/processor/stackwalker_x86.cc
index 654cb17e..cd259181 100644
--- a/src/processor/stackwalker_x86.cc
+++ b/src/processor/stackwalker_x86.cc
@@ -29,9 +29,8 @@ namespace google_airbag {
StackwalkerX86::StackwalkerX86(MinidumpContext* context,
MemoryRegion* memory,
MinidumpModuleList* modules,
- SymbolSupplier* supplier,
- void* supplier_data)
- : Stackwalker(memory, modules, supplier, supplier_data),
+ SymbolSupplier* supplier)
+ : Stackwalker(memory, modules, supplier),
last_frame_pointer_(0) {
if (memory_->GetBase() + memory_->GetSize() - 1 > 0xffffffff) {
// The x86 is a 32-bit CPU, the limits of the supplied stack are invalid.
diff --git a/src/processor/stackwalker_x86.h b/src/processor/stackwalker_x86.h
index 34be57eb..8696373c 100644
--- a/src/processor/stackwalker_x86.h
+++ b/src/processor/stackwalker_x86.h
@@ -45,8 +45,7 @@ class StackwalkerX86 : public Stackwalker {
StackwalkerX86(MinidumpContext* context,
MemoryRegion* memory,
MinidumpModuleList* modules,
- SymbolSupplier* supplier,
- void* supplier_data);
+ SymbolSupplier* supplier);
private:
// Implementation of Stackwalker, using x86 context (%ebp, %eip) and