Discussion:
[fpc-devel] New Debugging Aid
J. Gareth Moreton
2018-12-03 22:44:46 UTC
Permalink
Hi everyone,

I developed an aid to help me debug the peephole optimizer a while ago,
and I would like to present it as a possible permanent fixture to the
compiler if it is built with a particular define (DEBUG_ASMOUTPUT) - what
it does... during each pass of the peephole optimizer under i386 or x86_64
(the only platforms that currently have implementations - other platforms
won't do anything), the assembly of the current block is dumped to the
console in a colour-coded fashion for ease of identification.

It's not something you would normally build the compiler with, since the
console dump significantly increases the compilation time of a project, but
if you have the compiler open in a debugger, say, it allows you to see what
the peephole optimizer is working on if you put a breakpoint at the
beginning of the loop, say.  That way, you can see how the peephole
optimiser has modified the code and thus more easily identify bugs when
refactoring routines or adding new features.  I myself have been using it
to help with debugging my optimizer overhaul project.

Details can be found here: https://bugs.freepascal.org/view.php?id=34642
Gareth aka. Kit

Loading...