This is an old revision of the document!


How to debug D3D9

Compile both Mesa-3D and Wine with CFLAGS and CXXFLAGS set to debug.

CFLAGS="-Og -ggdb -pg -g -gdwarf-2 -gstrict-dwarf" CXXFLAGS="${CFLAGS}"
  • -Og is better than -O0 and disable optimalization which interfere with debug (gcc >= 4.8)
  • -ggdb, -pg, -g add debug informations to code
  • -gdwarf-2, -gstrict-dwarf limit DWARF version to 2. It's necessary for both, because wine support is limited to version 2.

Also configure Mesa-3D with

--enable-debug

Make sure, you had disabled striping debug symbols if you using distribution package, ebuild or AUR.

It depends on issue, you need to figure out, where is problem. If it's in mesa, you'll need use

  • NINE_DEBUG variable, to know what D3D9 ST doing. Pass NINE_DEBUG=help to get all options.
  • NINE_TGSI_DUMP=1 variable for dumping generated TGSI code.

For wine, WINEDEBUG=+d3dadapter9,+d3d9 should be enough.

For surpasing annoying dbghelp warnings pass WINEDEBUG=-dbghelp_dwarf.

You maybe also interested in apitrace.

APITrace

  • For debugging Windows application you'll need APITrace compiled for Windows
  • Windows version is almost always required for replaying