PW32: Debugging applications

Debugging applications compiled with PW32 can be divided into two cases:

In the first case, you will need to use debugging techniques if compiled application doesn't function correctly as it does on real POSIX real system. Because to PW32's aims, this is probably due bugs and misfeatures in PW32 itself. In the second case you'll probably first of all expect bugs in your application. In this case you use 'conventional' debugger and conventional debugging methods. However, first case is more complicated: you probably wrote neither application under porting nor PW32 ;-) , and stepping thru it all in debugger, wondering whether last function was performed right, is tedious task. To help with this, PW32 has "system trace facility" (strace) which can log all (or just selected groups of system calls, course of their execution, and results). So, you'll have global view of entire application's behaviour. Of course, both techniques can, and should, be used together, for example, when you'll find offending function with strace, you'll need to step thru it in debugger to acquire an idea what's wrong and how to fix. Below the two approaches discussed in more detail.

Strace facility

Strace facility can be activated in debug builds of PW32 (for now all builds are debug) by setting STRACE environment variable. PW32's strace facility is yet at preliminary stage and full description will be written when it stabilizes. For now following can be said:

The format of the strace log is generally slight variation of usual Unix (well, at least Linux) format. Below differences are listed:

Final note: the easiest way to start strace session is to use run-strace.bat utility:

run-strace <commandline>
By defualt, this will produce per-process logs for all facilities in default location. Tune run-strace.bat for your own needs.

Conventional debugging

The "standard" debugger for PW32 is Win32 port of DJGPP's Fullscreen Debugger (FSDB) (by Morten Welinder , DJ Delorie , Kent Williams and probably others). It functions somewhat well, and very it I use myself. However, before releasing it (it is GPL, by the way), some major cleanups on it should be done. It is source-level capable, fullscreen (you always have a view of registers, data dump, assembly code, etc.) debugger. Drop me a note if you'd like to have exactly that, ot can be a motivation to put more priority in releasing it.

In the meantime, you may use mingw32's gdb. I believe there're no issues with its using, though I usually don't use it myself, so please report any problems.

Please refer to links page, where some debugging solutions are collected.


Paul Sokolovsky | use this form to submit bug