пятница, 9 августа 2013 г.

IEDriverServer.exe debugging

IEDriverServer crashes sometimes. To debug it it's necessary to get crash report.
So i figure out how to enable collecting it. It's quite easy - just set up some keys in registry (for Windows 7 at least).

As Chef powershell resource it can be written as:
powershell "enable crash reports for IEDriverServer" do
  code <<-EOH
    if (Test-Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps") {
    } else {
      New-Item "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps"
    }
    if (Test-Path "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe") {
    } else {
      New-Item "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe"
    }
    Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpCount -Value 10
    Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpType -Value 2
    Set-ItemProperty "HKLM:\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps\\IEDriverServer.exe" -Name DumpFolder -Value "C:\\iedriverserver_crash\\"
  EOH
end
 In result if IEDriverServer crashes a new file .dmp will be created.

After that using MS Visual Studio and debug files as *.pdb which are generated during iedriver building (may require renaming IEDriver.dll to something as IED89D.tmp for proper symbols loading) you can investigate crash stacktrace, local variables etc.