Chromium Code Reviews| Index: snapshot/win/module_snapshot_win.cc |
| diff --git a/snapshot/win/module_snapshot_win.cc b/snapshot/win/module_snapshot_win.cc |
| index 86aae48f2e7cc0881feb3ddb3d1f346da1dba2c2..78373bf91a22475190383752928e9f0b3520113c 100644 |
| --- a/snapshot/win/module_snapshot_win.cc |
| +++ b/snapshot/win/module_snapshot_win.cc |
| @@ -29,6 +29,9 @@ ModuleSnapshotWin::ModuleSnapshotWin() |
| name_(), |
| timestamp_(0), |
| process_reader_(nullptr), |
| + uuid_(), |
| + age_(0), |
| + pdb_name_(), |
| initialized_() { |
| } |
| @@ -51,6 +54,20 @@ bool ModuleSnapshotWin::Initialize( |
| return false; |
| } |
| + DWORD age_dword; |
| + std::string full_pdb_name; |
| + if (pe_image_reader_->DebugDirectoryInformation( |
| + &uuid_, &age_dword, &full_pdb_name)) { |
| + static_assert(sizeof(DWORD) == sizeof(uint32_t), "unexpected age size"); |
| + age_ = age_dword; |
| + |
| + size_t last_slash = full_pdb_name.find_last_of("/\\"); |
|
Mark Mentovai
2015/10/28 20:01:11
I guess this can’t be a BaseName() because this is
scottmg
2015/10/28 20:59:25
Right on both counts. A quick check against MiniDu
|
| + if (last_slash != std::string::npos) |
| + pdb_name_ = full_pdb_name.substr(last_slash + 1); |
| + else |
| + pdb_name_ = full_pdb_name; |
| + } |
| + |
| INITIALIZATION_STATE_SET_VALID(initialized_); |
| return true; |
| } |
| @@ -137,16 +154,13 @@ ModuleSnapshot::ModuleType ModuleSnapshotWin::GetModuleType() const { |
| void ModuleSnapshotWin::UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const { |
| INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| - // TODO(scottmg): Consider passing pdbname through to snapshot. |
| - std::string pdbname; |
| - DWORD age_dword; |
| - if (!pe_image_reader_->DebugDirectoryInformation( |
| - uuid, &age_dword, &pdbname)) { |
| - *uuid = crashpad::UUID(); |
| - *age = 0; |
| - } |
| - static_assert(sizeof(DWORD) == sizeof(uint32_t), "unexpected age size"); |
| - *age = age_dword; |
| + *uuid = uuid_; |
| + *age = age_; |
| +} |
| + |
| +std::string ModuleSnapshotWin::PDBName() const { |
| + INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| + return pdb_name_; |
| } |
| std::vector<std::string> ModuleSnapshotWin::AnnotationsVector() const { |