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.
- Porting existing and working POSIX/Unix application
- Writing application from scratch
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:
Each line is prefixed with timestamp (either in HH:MM:SS.mmm
or in CPU clocks value) and pid.
- Entry for function can have more than one line. Conditions to have
exactly one line: interim tracing off, recursion level = 0.
- PW32's strace is not yet enough intelligent to represent values
is symbolic constants where appropriate. (Preliminary work is done).
- Ditto for structures displaying.
- PW32's doesn't log signal yet.
Final note: the easiest way to start strace session is to use
By defualt, this will produce per-process logs for all facilities in
default location. Tune run-strace.bat for your own needs.
The "standard" debugger for PW32 is Win32 port of DJGPP's Fullscreen Debugger
(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
Please refer to links page, where
some debugging solutions are collected.
| use this form to submit bug