From db3342a10ec30902aa9018b80e1d9a40bd01c487 Mon Sep 17 00:00:00 2001 From: mmentovai Date: Tue, 5 Dec 2006 22:52:28 +0000 Subject: 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 --- src/processor/minidump_processor.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/processor/minidump_processor.cc') diff --git a/src/processor/minidump_processor.cc b/src/processor/minidump_processor.cc index f9f8066a..d2c44159 100644 --- a/src/processor/minidump_processor.cc +++ b/src/processor/minidump_processor.cc @@ -75,6 +75,14 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { &dump, &process_state->crash_address_); } + MinidumpModuleList *module_list = dump.GetModuleList(); + + // Put a copy of the module list into ProcessState object. This is not + // necessarily a MinidumpModuleList, but it adheres to the CodeModules + // interface, which is all that ProcessState needs to expose. + if (module_list) + process_state->modules_ = module_list->Copy(); + MinidumpThreadList *threads = dump.GetThreadList(); if (!threads) { return NULL; @@ -137,10 +145,18 @@ ProcessState* MinidumpProcessor::Process(const string &minidump_file) { return NULL; } + // Use process_state->modules_ instead of module_list, because the + // |modules| argument will be used to populate the |module| fields in + // the returned StackFrame objects, which will be placed into the + // returned ProcessState object. module_list's lifetime is only as + // long as the Minidump object: it will be deleted when this function + // returns. process_state->modules_ is owned by the ProcessState object + // (just like the StackFrame objects), and is much more suitable for this + // task. scoped_ptr stackwalker( Stackwalker::StackwalkerForCPU(context, thread_memory, - dump.GetModuleList(), + process_state->modules_, supplier_)); if (!stackwalker.get()) { return NULL; -- cgit v1.2.1