@@ -171,9 +171,7 @@ std::vector<StackFrame> CrashReportingWindows::GetThreadFrames(int32_t tid, Reso
171
171
if (module != nullptr )
172
172
{
173
173
stackFrame.moduleAddress = module->startAddress ;
174
- stackFrame.hasPdbInfo = module->hasPdbInfo ;
175
- stackFrame.pdbAge = module->pdbAge ;
176
- stackFrame.pdbSig = module->pdbSig ;
174
+ stackFrame.buildId = module->buildId ;
177
175
178
176
std::ostringstream methodName;
179
177
methodName << module->path << " !<unknown>+" << std::hex << (nativeStackFrame.AddrPC .Offset - module->startAddress );
@@ -233,10 +231,9 @@ std::vector<ModuleInfo> CrashReportingWindows::GetModules()
233
231
resolvedModuleName = moduleName;
234
232
}
235
233
236
- ModuleInfo module{ (uintptr_t )moduleInfo.lpBaseOfDll , (uintptr_t )moduleInfo.lpBaseOfDll + moduleInfo.SizeOfImage , std::move (resolvedModuleName), false , 0 , 0 };
237
-
238
- FillPdbInfo ((uintptr_t )moduleInfo.lpBaseOfDll , module);
234
+ auto buildId = ExtractBuildId ((uintptr_t )moduleInfo.lpBaseOfDll );
239
235
236
+ ModuleInfo module{(uintptr_t )moduleInfo.lpBaseOfDll , (uintptr_t )moduleInfo.lpBaseOfDll + moduleInfo.SizeOfImage , std::move (resolvedModuleName), std::move (buildId)};
240
237
modules.push_back (std::move (module));
241
238
}
242
239
}
@@ -271,35 +268,35 @@ std::vector<BYTE> CrashReportingWindows::ReadRemoteMemory(HANDLE process, uintpt
271
268
return {};
272
269
}
273
270
274
- bool CrashReportingWindows::FillPdbInfo (uintptr_t baseAddress, ModuleInfo& moduleInfo )
271
+ BuildId CrashReportingWindows::ExtractBuildId (uintptr_t baseAddress)
275
272
{
276
273
// Read the DOS header
277
274
auto dosHeaderBuffer = _readMemory (baseAddress, sizeof (IMAGE_DOS_HEADER));
278
275
if (dosHeaderBuffer.empty ())
279
276
{
280
- return false ;
277
+ return {} ;
281
278
}
282
279
283
280
auto dosHeader = reinterpret_cast <PIMAGE_DOS_HEADER>(dosHeaderBuffer.data ());
284
281
285
282
if (dosHeader->e_magic != IMAGE_DOS_SIGNATURE)
286
283
{
287
- return false ;
284
+ return {} ;
288
285
}
289
286
290
287
// Read the NT headers
291
288
uintptr_t ntHeadersAddress = baseAddress + dosHeader->e_lfanew ;
292
289
auto ntHeadersBuffer = _readMemory (ntHeadersAddress, sizeof (IMAGE_NT_HEADERS_GENERIC));
293
290
if (ntHeadersBuffer.empty ())
294
291
{
295
- return false ;
292
+ return {} ;
296
293
}
297
294
298
295
auto ntHeaders = reinterpret_cast <IMAGE_NT_HEADERS_GENERIC*>(ntHeadersBuffer.data ());
299
296
300
297
if (ntHeaders->Signature != IMAGE_NT_SIGNATURE)
301
298
{
302
- return false ;
299
+ return {} ;
303
300
}
304
301
305
302
// Check the PE type
@@ -308,7 +305,7 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
308
305
309
306
if (!isPE32 && !isPE64)
310
307
{
311
- return false ;
308
+ return {} ;
312
309
}
313
310
314
311
// Read the debug directory according to the PE type
@@ -319,7 +316,7 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
319
316
auto header32Buffer = _readMemory (ntHeadersAddress, sizeof (IMAGE_NT_HEADERS32));
320
317
if (header32Buffer.empty ())
321
318
{
322
- return false ;
319
+ return {} ;
323
320
}
324
321
325
322
auto header32 = reinterpret_cast <IMAGE_NT_HEADERS32*>(header32Buffer.data ());
@@ -330,7 +327,7 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
330
327
auto header64Buffer = _readMemory (ntHeadersAddress, sizeof (IMAGE_NT_HEADERS64));
331
328
if (header64Buffer.empty ())
332
329
{
333
- return false ;
330
+ return {} ;
334
331
}
335
332
336
333
auto header64 = reinterpret_cast <IMAGE_NT_HEADERS64*>(header64Buffer.data ());
@@ -340,13 +337,13 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
340
337
uintptr_t debugDirectoryAddress = baseAddress + debugDataDir.VirtualAddress ;
341
338
if (debugDirectoryAddress == 0 )
342
339
{
343
- return false ;
340
+ return {} ;
344
341
}
345
342
346
343
auto debugDirectoryBuffer = _readMemory (debugDirectoryAddress, debugDataDir.Size );
347
344
if (debugDirectoryBuffer.empty ())
348
345
{
349
- return false ;
346
+ return {} ;
350
347
}
351
348
352
349
auto debugDirectory = reinterpret_cast <PIMAGE_DEBUG_DIRECTORY>(debugDirectoryBuffer.data ());
@@ -367,10 +364,10 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
367
364
// Extract the PDB info from the codeview entry
368
365
auto pdbInfoAddress = baseAddress + debugDirectory[i].AddressOfRawData ;
369
366
auto pdbInfoBuffer = _readMemory (pdbInfoAddress, sizeof (CV_INFO_PDB70));
370
-
367
+
371
368
if (pdbInfoBuffer.empty ())
372
369
{
373
- return false ;
370
+ return {} ;
374
371
}
375
372
376
373
auto pdbInfo = reinterpret_cast <CV_INFO_PDB70*>(pdbInfoBuffer.data ());
@@ -379,16 +376,12 @@ bool CrashReportingWindows::FillPdbInfo(uintptr_t baseAddress, ModuleInfo& modul
379
376
380
377
if (pdbInfo->Signature == PDB70_SIGNATURE)
381
378
{
382
- moduleInfo.pdbAge = pdbInfo->Age ;
383
- moduleInfo.pdbSig = pdbInfo->Guid ;
384
- moduleInfo.hasPdbInfo = true ;
385
-
386
- return true ;
379
+ return BuildId::From (pdbInfo->Guid , pdbInfo->Age );
387
380
}
388
381
}
389
382
}
390
383
391
- return false ;
384
+ return {} ;
392
385
}
393
386
394
387
void CrashReportingWindows::SetMemoryReader (std::function<std::vector<BYTE>(uintptr_t , SIZE_T)> readMemory)
0 commit comments