aboutsummaryrefslogtreecommitdiff
path: root/src/processor/stackwalker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/processor/stackwalker.cc')
-rw-r--r--src/processor/stackwalker.cc35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc
index edbe428a..e6a26bb9 100644
--- a/src/processor/stackwalker.cc
+++ b/src/processor/stackwalker.cc
@@ -41,11 +41,11 @@
#include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h"
#include "google_airbag/processor/minidump.h"
+#include "google_airbag/processor/source_line_resolver_interface.h"
#include "google_airbag/processor/stack_frame.h"
#include "google_airbag/processor/symbol_supplier.h"
#include "processor/linked_ptr.h"
#include "processor/scoped_ptr.h"
-#include "processor/source_line_resolver.h"
#include "processor/stack_frame_info.h"
#include "processor/stackwalker_ppc.h"
#include "processor/stackwalker_x86.h"
@@ -54,14 +54,17 @@ namespace google_airbag {
Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules,
- SymbolSupplier *supplier)
- : memory_(memory), modules_(modules), supplier_(supplier) {
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver)
+ : memory_(memory),
+ modules_(modules),
+ supplier_(supplier),
+ resolver_(resolver) {
}
bool Stackwalker::Walk(CallStack *stack) {
assert(stack);
- SourceLineResolver resolver;
stack->Clear();
// stack_frame_info parallels the CallStack. The vector is passed to the
@@ -88,14 +91,16 @@ bool Stackwalker::Walk(CallStack *stack) {
modules_->GetModuleForAddress(frame->instruction);
if (module) {
frame->module = module;
- if (!resolver.HasModule(frame->module->code_file()) && supplier_) {
+ if (resolver_ &&
+ !resolver_->HasModule(frame->module->code_file()) &&
+ supplier_) {
string symbol_file;
SymbolSupplier::SymbolResult symbol_result =
supplier_->GetSymbolFile(module, &symbol_file);
switch (symbol_result) {
case SymbolSupplier::FOUND:
- resolver.LoadModule(frame->module->code_file(), symbol_file);
+ resolver_->LoadModule(frame->module->code_file(), symbol_file);
break;
case SymbolSupplier::NOT_FOUND:
break; // nothing to do
@@ -103,7 +108,7 @@ bool Stackwalker::Walk(CallStack *stack) {
return false;
}
}
- frame_info.reset(resolver.FillSourceLineInfo(frame.get()));
+ frame_info.reset(resolver_->FillSourceLineInfo(frame.get()));
}
}
@@ -124,22 +129,26 @@ bool Stackwalker::Walk(CallStack *stack) {
// static
-Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
- MemoryRegion *memory,
- const CodeModules *modules,
- SymbolSupplier *supplier) {
+Stackwalker* Stackwalker::StackwalkerForCPU(
+ MinidumpContext *context,
+ MemoryRegion *memory,
+ const CodeModules *modules,
+ SymbolSupplier *supplier,
+ SourceLineResolverInterface *resolver) {
Stackwalker *cpu_stackwalker = NULL;
u_int32_t cpu = context->GetContextCPU();
switch (cpu) {
case MD_CONTEXT_X86:
cpu_stackwalker = new StackwalkerX86(context->GetContextX86(),
- memory, modules, supplier);
+ memory, modules, supplier,
+ resolver);
break;
case MD_CONTEXT_PPC:
cpu_stackwalker = new StackwalkerPPC(context->GetContextPPC(),
- memory, modules, supplier);
+ memory, modules, supplier,
+ resolver);
break;
}