Skip to content

Debugging on Windows

John Haddon edited this page Apr 6, 2023 · 2 revisions

Microsoft's WinDbg program offers many helpful features for debugging both release and debug builds of Gaffer. This page gives tips on using it for common tasks. It can be installed from the Windows app store.

Attaching to a Gaffer process

If you are debugging a problem that occurs after starting Gaffer, attaching to a running Gaffer process is usually the easiest way to connect WinDbg to Gaffer. To do so :

  1. Start Gaffer and WinDbg
  2. Once Gaffer is started, go to the File menu of WinDbg. Select Attach To Process and find the Gaffer process. It will actually be called python.exe, which you can search for in the box at the top right of the window
  3. WinDbg will load some modules, attach itself to the Gaffer python process, and pause Gaffer. Press the "Go" button to resume Gaffer

Executing WinDbg commands

The main window of WinDbg is a command panel by default. It will show what WinDbg is doing as you debug, and you can also execute commands specific to WinDbg. The picture below shows an example of exporting a stack trace and where to enter debug commands.

image

Stack Trace

There is a dedicated panel for the call stack, but it can also be useful to export the stack trace for sharing. You can export the stack trace using the .dump <output path.dmp> command in WinDbg's command window.

You can load a stack trace from the File menu of WinDbg and selecting Open Dump File and browsing to the debug file.