diff options
author | bryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-12-08 04:13:51 +0000 |
---|---|---|
committer | bryner <bryner@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2006-12-08 04:13:51 +0000 |
commit | f33b8d2d07a057fdd667c2e0db629ba7cbc37cc3 (patch) | |
tree | 07ea0ac380d1f401750f7f9cea85907064e037f3 /src/processor/stackwalker.cc | |
parent | Allow exception handler callbacks more flexibility (#81). r=bryner (diff) | |
download | breakpad-f33b8d2d07a057fdd667c2e0db629ba7cbc37cc3.tar.xz |
Provide a mechanism for SymbolSuppliers to interrupt processing (#93)
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@80 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/stackwalker.cc')
-rw-r--r-- | src/processor/stackwalker.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc index 4e4a6b9f..edbe428a 100644 --- a/src/processor/stackwalker.cc +++ b/src/processor/stackwalker.cc @@ -34,6 +34,8 @@ // Author: Mark Mentovai +#include <cassert> + #include "google_airbag/processor/stackwalker.h" #include "google_airbag/processor/call_stack.h" #include "google_airbag/processor/code_module.h" @@ -57,10 +59,10 @@ Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules, } -CallStack* Stackwalker::Walk() { +bool Stackwalker::Walk(CallStack *stack) { + assert(stack); SourceLineResolver resolver; - - scoped_ptr<CallStack> stack(new CallStack()); + stack->Clear(); // stack_frame_info parallels the CallStack. The vector is passed to the // GetCallerFrame function. It contains information that may be helpful @@ -87,9 +89,18 @@ CallStack* Stackwalker::Walk() { if (module) { frame->module = module; if (!resolver.HasModule(frame->module->code_file()) && supplier_) { - string symbol_file = supplier_->GetSymbolFile(module); - if (!symbol_file.empty()) { - resolver.LoadModule(frame->module->code_file(), symbol_file); + 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); + break; + case SymbolSupplier::NOT_FOUND: + break; // nothing to do + case SymbolSupplier::INTERRUPT: + return false; } } frame_info.reset(resolver.FillSourceLineInfo(frame.get())); @@ -105,10 +116,10 @@ CallStack* Stackwalker::Walk() { frame_info.reset(NULL); // Get the next frame and take ownership. - frame.reset(GetCallerFrame(stack.get(), stack_frame_info)); + frame.reset(GetCallerFrame(stack, stack_frame_info)); } - return stack.release(); + return true; } |