aboutsummaryrefslogtreecommitdiff
path: root/src/common/windows
diff options
context:
space:
mode:
authorted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-31 15:08:49 +0000
committerted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-08-31 15:08:49 +0000
commit6c7d641dc9052fa1fe731bf04388fa1a2eb34fc9 (patch)
treeb16fe2b46b1ade97c64414133a9bc97fde1160b6 /src/common/windows
parentLinux FileID should work with ELFCLASS32 and ELFCLASS64 regardless of what's (diff)
downloadbreakpad-6c7d641dc9052fa1fe731bf04388fa1a2eb34fc9.tar.xz
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
Diffstat (limited to 'src/common/windows')
-rw-r--r--src/common/windows/pdb_source_line_writer.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc
index 9cd0d2e3..48a35bed 100644
--- a/src/common/windows/pdb_source_line_writer.cc
+++ b/src/common/windows/pdb_source_line_writer.cc
@@ -764,11 +764,25 @@ bool PDBSourceLineWriter::GetModuleInfo(PDBModuleInfo *info) {
return false;
}
- // All CPUs in CV_CPU_TYPE_e (cvconst.h) below 0x10 are x86. There's no
- // single specific constant to use.
- DWORD platform;
- if (SUCCEEDED(global->get_platform(&platform)) && platform < 0x10) {
- info->cpu = L"x86";
+ DWORD machine_type;
+ // get_machineType can return S_FALSE.
+ if (global->get_machineType(&machine_type) == S_OK) {
+ // The documentation claims that get_machineType returns a value from
+ // 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 {
// Unexpected, but handle gracefully.
info->cpu = L"unknown";