Skip to content

Instantly share code, notes, and snippets.

@wilhelmberg
Last active May 15, 2019 14:26
Show Gist options
  • Save wilhelmberg/534a5e74301c5607af5c to your computer and use it in GitHub Desktop.
Save wilhelmberg/534a5e74301c5607af5c to your computer and use it in GitHub Desktop.
Part 2: Debug MapBox Studio on Windows using WinDbg

Links:

Get WinDbg

  • goto WDK and WinDbg downloads
  • scroll down to Standalone Debugging Tools for Windows (WinDbg)
  • Get the standalone debugging tools (WinDbg) as part of Windows 8.1 SDK
  • execute sdksetup.exe
  • just select Debugging Tools for Windows
  • install

Use WinDbg

Prepare for crash

  • Start -> All Programs -> Windows Kits -> Debugging Tools for Windows (x64) -> WinDbg (x64)
  • File -> Open -> Executable:
    • File name:C:\Program Files\mapbox-studio\resources\app\vendor\node.exe
    • Arguments: "C:\Program Files\mapbox-studio\resources\app\index.js"
    • check Debug child processes also
  • Check in Task Manager that there is only one instance of node.exe
  • Enter commands one at a time on the prompt at the bottom
.sympath SRV*C:\debugsymbols*http://msdl.microsoft.com/download/symbols
.symfix+ c:\debugsymbols
!sym noisy
.reload /f
  • wait till *BUSY* at the bottom left disappears
  • Enter commands one at a time on the prompt at the bottom
.logopen /t c:\mbslog\log.txt
.childdbg 1
.tlist
|* lm
  • now run mbs by: Debug -> Go

If you see an exception in the WinDbg command window that says ntdll32!LdrpDoDebuggerBreak+0x2c or ntdll32!LdrpDoDebuggerBreak+0x30, enter those commands:

bp ntdll!LdrpDoDebuggerBreak+0x30
bp ntdll!LdrpDoDebuggerBreak+0x2c
eb ntdll!LdrpDoDebuggerBreak+0x30 0x90
eb ntdll!LdrpDoDebuggerBreak+0x2c 0x90
----
To continue click: Debug -> Go

After the crash

  • Enter commands:
!peb
.reload /f
!teb
|* ~* kp
|* !analyze -v -f
|* lm
  • Create a dump file (might take some time): .dump /ma c:\mbslog\mbs-crash.dmp
  • exit WinDbg
  • the DMP files can be huge, but they compress really well with 7z (www.7-zip.org) and compression set to Ultra.
  • send log and 7-zipped dump files from c:\mbslog\ to developer, who pointed you to this gist

References

###General

WinDbg General

Stack Trace

Memory

!address -summary -> build memory map
!heap -s -> heap summary
!heap -stat -h 0 -> allocation statistics
!heap -srch [Size] <pattern> -> scan all heap for pattern
!heap -flt s <obj-size> -> filter heap by object size
filter all loaded modules by object size:
!for_each_module ".echo @#ModuleName;dt -v -s <obj-size>  ${@#ModuleName}!*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment