Add support to the StackWalker for resolving symbols, using a

caller-implemented SymbolSupplier object to get a symbol file.

Add a CrashReportProcessor object which provides a simple API for processing
a CrashReport struct, given a SymbolSupplier and a minidump file.

r=mmentovai (#17))


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@18 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
bryner 2006-09-08 02:35:53 +00:00
parent 39716226cf
commit d5e66382d1
17 changed files with 14492 additions and 3332 deletions

View file

@ -23,6 +23,8 @@
#include "processor/stackwalker.h"
#include "processor/minidump.h"
#include "processor/source_line_resolver.h"
#include "google/symbol_supplier.h"
namespace google_airbag {
@ -31,13 +33,19 @@ namespace google_airbag {
using std::auto_ptr;
Stackwalker::Stackwalker(MemoryRegion* memory, MinidumpModuleList* modules)
: memory_(memory), modules_(modules) {
Stackwalker::Stackwalker(MemoryRegion* memory, MinidumpModuleList* modules,
SymbolSupplier *supplier, const CrashReport *report)
: memory_(memory),
modules_(modules),
supplier_(supplier),
report_(report) {
}
StackFrames* Stackwalker::Walk() {
auto_ptr<StackFrames> frames(new StackFrames());
void Stackwalker::Walk(StackFrames *frames) {
frames->clear();
bool resolve_symbols = (modules_ && supplier_);
SourceLineResolver resolver;
// Begin with the context frame, and keep getting callers until there are
// no more.
@ -56,6 +64,13 @@ StackFrames* Stackwalker::Walk() {
if (module) {
frame->module_name = *(module->GetName());
frame->module_base = module->base_address();
if (resolve_symbols) {
string symbol_file = supplier_->GetSymbolFile(module, report_);
if (!symbol_file.empty()) {
resolver.LoadModule(*(module->GetName()), symbol_file);
}
resolver.FillSourceLineInfo(frame.get());
}
}
}
@ -70,8 +85,6 @@ StackFrames* Stackwalker::Walk() {
// Get the next frame.
valid = GetCallerFrame(frame.get());
}
return frames.release();
}