Issue 370 - fix PDBSourceLineWriter::GetModuleInfo's CPU detection

R=nealsid at http://breakpad.appspot.com/181001

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@678 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek 2010-08-31 15:08:49 +00:00
parent 3a7466663c
commit 6c7d641dc9

View file

@ -764,11 +764,25 @@ bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) {
return false; return false;
} }
// All CPUs in CV_CPU_TYPE_e (cvconst.h) below 0x10 are x86. There's no DWORD machine_type;
// single specific constant to use. // get_machineType can return S_FALSE.
DWORD platform; if (global->get_machineType(&machine_type) == S_OK) {
if (SUCCEEDED(global->get_platform(&platform)) && platform < 0x10) { // The documentation claims that get_machineType returns a value from
info->cpu = L"x86"; // the CV_CPU_TYPE_e enumeration, but that's not the case.
// Instead, it returns one of the IMAGE_FILE_MACHINE values as
// defined here:
// http://msdn.microsoft.com/en-us/library/ms680313%28VS.85%29.aspx
switch (machine_type) {
case IMAGE_FILE_MACHINE_I386:
info->cpu = L"x86";
break;
case IMAGE_FILE_MACHINE_AMD64:
info->cpu = L"x86_64";
break;
default:
info->cpu = L"unknown";
break;
}
} else { } else {
// Unexpected, but handle gracefully. // Unexpected, but handle gracefully.
info->cpu = L"unknown"; info->cpu = L"unknown";