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

@ -34,61 +34,45 @@
// Author: Mark Mentovai
#include "processor/simple_symbol_supplier.h"
#include "google_airbag/processor/minidump.h"
#include "google_airbag/processor/code_module.h"
#include "processor/pathname_stripper.h"
namespace google_airbag {
string SimpleSymbolSupplier::GetSymbolFileAtPath(MinidumpModule *module,
string SimpleSymbolSupplier::GetSymbolFileAtPath(const CodeModule *module,
const string &root_path) {
// For now, only support modules that have GUIDs - which means
// MDCVInfoPDB70.
if (!module)
return "";
const MDCVInfoPDB70 *cv_record =
reinterpret_cast<const MDCVInfoPDB70*>(module->GetCVRecord());
if (!cv_record)
return "";
if (cv_record->cv_signature != MD_CVINFOPDB70_SIGNATURE)
return "";
// Start with the base path.
string path = root_path;
// Append the pdb file name as a directory name.
// Append the debug (pdb) file name as a directory name.
path.append("/");
string pdb_file_name = PathnameStripper::File(
reinterpret_cast<const char *>(cv_record->pdb_file_name));
path.append(pdb_file_name);
string debug_file_name = PathnameStripper::File(module->debug_file());
if (debug_file_name.empty())
return "";
path.append(debug_file_name);
// Append the uuid and age as a directory name.
// Append the identifier as a directory name.
path.append("/");
char uuid_age_string[43];
snprintf(uuid_age_string, sizeof(uuid_age_string),
"%08X%04X%04X%02X%02X%02X%02X%02X%02X%02X%02X%X",
cv_record->signature.data1, cv_record->signature.data2,
cv_record->signature.data3,
cv_record->signature.data4[0], cv_record->signature.data4[1],
cv_record->signature.data4[2], cv_record->signature.data4[3],
cv_record->signature.data4[4], cv_record->signature.data4[5],
cv_record->signature.data4[6], cv_record->signature.data4[7],
cv_record->age);
path.append(uuid_age_string);
string identifier = module->debug_identifier();
if (identifier.empty())
return "";
path.append(identifier);
// Transform the pdb file name into one ending in .sym. If the existing
// Transform the debug file name into one ending in .sym. If the existing
// name ends in .pdb, strip the .pdb. Otherwise, add .sym to the non-.pdb
// name.
path.append("/");
string pdb_file_extension = pdb_file_name.substr(pdb_file_name.size() - 4);
transform(pdb_file_extension.begin(), pdb_file_extension.end(),
pdb_file_extension.begin(), tolower);
if (pdb_file_extension == ".pdb") {
path.append(pdb_file_name.substr(0, pdb_file_name.size() - 4));
string debug_file_extension =
debug_file_name.substr(debug_file_name.size() - 4);
transform(debug_file_extension.begin(), debug_file_extension.end(),
debug_file_extension.begin(), tolower);
if (debug_file_extension == ".pdb") {
path.append(debug_file_name.substr(0, debug_file_name.size() - 4));
} else {
path.append(pdb_file_name);
path.append(debug_file_name);
}
path.append(".sym");