Bug 607046. Add extra logging info for debugging invalid vendorID problems. r=gavin,a=gavin

This commit is contained in:
Jeff Muizelaar 2010-11-25 15:44:37 -05:00
parent 8c7ff59e05
commit 7499e2aca1
2 changed files with 24 additions and 8 deletions

View File

@ -171,18 +171,16 @@ GfxInfo::Init()
displayDevice.cb = sizeof(displayDevice);
int deviceIndex = 0;
mDeviceKeyDebug = NS_LITERAL_STRING("PrimarySearch");
while (EnumDisplayDevicesW(NULL, deviceIndex, &displayDevice, 0)) {
if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
mDeviceKeyDebug = NS_LITERAL_STRING("NullSearch");
break;
}
deviceIndex++;
}
/* DeviceKey is "reserved" according to MSDN so we'll be careful with it */
/* check that DeviceKey begins with DEVICE_KEY_PREFIX */
/* some systems have a DeviceKey starting with \REGISTRY\Machine\ so we need to compare case insenstively */
if (_wcsnicmp(displayDevice.DeviceKey, DEVICE_KEY_PREFIX, NS_ARRAY_LENGTH(DEVICE_KEY_PREFIX)-1) != 0)
return;
// make sure the string is NULL terminated
if (wcsnlen(displayDevice.DeviceKey, NS_ARRAY_LENGTH(displayDevice.DeviceKey))
== NS_ARRAY_LENGTH(displayDevice.DeviceKey)) {
@ -190,6 +188,14 @@ GfxInfo::Init()
return;
}
mDeviceKeyDebug = displayDevice.DeviceKey;
/* DeviceKey is "reserved" according to MSDN so we'll be careful with it */
/* check that DeviceKey begins with DEVICE_KEY_PREFIX */
/* some systems have a DeviceKey starting with \REGISTRY\Machine\ so we need to compare case insenstively */
if (_wcsnicmp(displayDevice.DeviceKey, DEVICE_KEY_PREFIX, NS_ARRAY_LENGTH(DEVICE_KEY_PREFIX)-1) != 0)
return;
// chop off DEVICE_KEY_PREFIX
mDeviceKey = displayDevice.DeviceKey + NS_ARRAY_LENGTH(DEVICE_KEY_PREFIX)-1;
@ -364,7 +370,16 @@ GfxInfo::AddCrashReportAnnotations()
nsCAutoString note;
/* AppendPrintf only supports 32 character strings, mrghh. */
note.AppendPrintf("AdapterVendorID: %04x, ", vendorID);
note.AppendPrintf("AdapterDeviceID: %04x\n", deviceID);
note.AppendPrintf("AdapterDeviceID: %04x", deviceID);
if (vendorID == 0) {
/* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
note.Append(", ");
note.AppendWithConversion(mDeviceKeyDebug);
note.Append(", ");
note.AppendWithConversion(mDeviceID);
}
note.Append("\n");
CrashReporter::AppendAppNotesToCrashReport(note);

View File

@ -62,6 +62,7 @@ private:
nsString mDriverVersion;
nsString mDriverDate;
nsString mDeviceKey;
nsString mDeviceKeyDebug;
nsresult GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion);
};