From 8d70618ffc6f87bfd3d7bfd05c87c35ec3179a7a Mon Sep 17 00:00:00 2001 From: "ted.mielczarek" Date: Thu, 8 Oct 2009 14:21:50 +0000 Subject: Let x86 stackwalker scan stack in cases where program evaluation fails. Original patch by Jeff Muizelaar with some changes by me. r=mento at http://breakpad.appspot.com/32003/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@409 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/stackwalker.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/processor/stackwalker.cc') diff --git a/src/processor/stackwalker.cc b/src/processor/stackwalker.cc index de67bdaa..96ee6db0 100644 --- a/src/processor/stackwalker.cc +++ b/src/processor/stackwalker.cc @@ -189,5 +189,39 @@ Stackwalker* Stackwalker::StackwalkerForCPU( return cpu_stackwalker; } +bool Stackwalker::InstructionAddressSeemsValid(u_int64_t address) { + const CodeModule *module = modules_->GetModuleForAddress(address); + if (!module) { + // not inside any loaded module + return false; + } + + if (!resolver_ || !supplier_) { + // we don't have a resolver and or symbol supplier, + // but we're inside a known module + return true; + } + + if (!resolver_->HasModule(module->code_file())) { + string symbol_data, symbol_file; + SymbolSupplier::SymbolResult symbol_result = + supplier_->GetSymbolFile(module, system_info_, + &symbol_file, &symbol_data); + + if (symbol_result != SymbolSupplier::FOUND || + !resolver_->LoadModuleUsingMapBuffer(module->code_file(), + symbol_data)) { + // we don't have symbols, but we're inside a loaded module + return true; + } + } + + StackFrame frame; + frame.module = module; + frame.instruction = address; + resolver_->FillSourceLineInfo(&frame); + // we have symbols, so return true if inside a function + return !frame.function_name.empty(); +} } // namespace google_breakpad -- cgit v1.2.1