mlachwani / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

PDBSourceLineWriter::GetModuleInfo's CPU detection doesn't actually work #370

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The code here:
http://code.google.com/p/google-breakpad/source/browse/trunk/src/common/windows/
pdb_source_line_writer.cc#769

uses get_platform() on the global symbol to try to find out what CPU
architecture it's compiled for. Unfortunately this doesn't actually work,
and this code only works by accident. Using SUCCEEDED() to check the return
value is not correct, since it can return S_FALSE to mean "the method
succeeded but this symbol doesn't have this attribute":
http://msdn.microsoft.com/en-us/library/83cacfdt.aspx
which is what's actually happening here. The method also sets the value to
0, so it passes the "platform < 0x10" test, and we get x86. Oops.

Unfortunately, I can't seem to get anything else to work. The documentation
for the SymTagExe symbol:
http://msdn.microsoft.com/en-us/library/58tcs2t0.aspx
mentions get_machineType:
http://msdn.microsoft.com/en-us/library/58bt7xh6%28VS.100%29.aspx
which does succeed on the global (with S_OK), but the value it returns is
0x14E, which is not a valid member of the CV_CPU_TYPE_e enum, so I'm kind
of lost.

Original issue reported on code.google.com by ted.mielczarek on 19 Feb 2010 at 3:53

GoogleCodeExporter commented 9 years ago
I figured this out. We need to use get_machineType. The documentation is wrong 
about its return values. I uploaded a patch here:
http://breakpad.appspot.com/181001

Original comment by ted.mielczarek on 31 Aug 2010 at 2:44

GoogleCodeExporter commented 9 years ago
Fixed in r678.

Original comment by ted.mielczarek on 31 Aug 2010 at 3:11