Module API (#32). r=waylonis, bryner

- Introduces a standard API for dealing with modules.  MinidumpModule
   is now a concrete implementation of this API.  Code may interact with
   single modules using the CodeModule interface, and collections of
   modules using its container, the CodeModules interface.
 - CodeModule is used directly by SymbolSupplier implementations and
   SourceLineResolver.  Reliance on the specific implementation in
   MinidumpModule has been eliminated.
 - Module lists are now added to ProcessState objects.  Module references
   in each stack frame are now pointers to objects in these module lists.
 - The sample minidump_stackwalk tool prints the module list after printing
   all threads' stacks.

http://groups.google.com/group/airbag-dev/browse_frm/thread/a9c0550edde54cf8


git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@74 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mmentovai
2006-12-05 22:52:28 +00:00
parent ed61ae0bbd
commit db3342a10e
36 changed files with 1515 additions and 351 deletions

View File

@@ -36,6 +36,8 @@
#include "google_airbag/processor/stackwalker.h"
#include "google_airbag/processor/call_stack.h"
#include "google_airbag/processor/code_module.h"
#include "google_airbag/processor/code_modules.h"
#include "google_airbag/processor/minidump.h"
#include "google_airbag/processor/stack_frame.h"
#include "google_airbag/processor/symbol_supplier.h"
@@ -49,7 +51,7 @@
namespace google_airbag {
Stackwalker::Stackwalker(MemoryRegion *memory, MinidumpModuleList *modules,
Stackwalker::Stackwalker(MemoryRegion *memory, const CodeModules *modules,
SymbolSupplier *supplier)
: memory_(memory), modules_(modules), supplier_(supplier) {
}
@@ -80,15 +82,14 @@ CallStack* Stackwalker::Walk() {
// Resolve the module information, if a module map was provided.
if (modules_) {
MinidumpModule *module =
const CodeModule *module =
modules_->GetModuleForAddress(frame->instruction);
if (module) {
frame->module_name = *(module->GetName());
frame->module_base = module->base_address();
if (!resolver.HasModule(frame->module_name) && supplier_) {
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_name, symbol_file);
resolver.LoadModule(frame->module->code_file(), symbol_file);
}
}
frame_info.reset(resolver.FillSourceLineInfo(frame.get()));
@@ -114,7 +115,7 @@ CallStack* Stackwalker::Walk() {
// static
Stackwalker* Stackwalker::StackwalkerForCPU(MinidumpContext *context,
MemoryRegion *memory,
MinidumpModuleList *modules,
const CodeModules *modules,
SymbolSupplier *supplier) {
Stackwalker *cpu_stackwalker = NULL;