[fpc-devel] XML node dump feature
J. Gareth Moreton
gareth at moreton-family.com
Wed Feb 6 03:47:25 CET 2019
Hi everyone,
So there's a few limitations with the XML dump. Firstly it does its work
before the second pass, so things like inlined functions are not yet
expanded. There are still some minor bugs to work out, like if a string
literal contains < and >, for example, it can cause the XML file to become
malformed, so I'll have to make a global string-sanitising function that
addresses these characters.
I did try putting it after the second pass in my own copy of FPC, but some
problems occurred when it came to the assembly language that's inserted to
make up the function prologue. I'll work this out a bit later, since I
need to rest now!
In the meantime, the patches in the bug report are ready for testing,
although they might not be ready for including in the trunk due to the
aforementioned problems. Still, it's up to you.
Gareth aka. Kit
On Tue 05/02/19 17:53 , "J. Gareth Moreton" gareth at moreton-family.com
sent:
Hi everyone,
As has been discussed a little bit on here in the past, I've done a bit
more work on my XML node dumping feature. If the compiler is built with
the "DEBUG_NODE_DUMP" define, all source files compiled with it will have
their intermediate nodes dumped to an XML file (they have .ppx
extensions). The patch and details can be found here:
https://bugs.freepascal.org/view.php?id=35017
It's a feature I intend to use for improving some of the mathematical
functions like "floor". Given that the nodes form trees, this is one of
the few cases where XML files are perfect for representing them, especially
as, with an appropriate editor, you can collapse trees that you're not
interested in viewing (for something like the System unit, which produces a
9 MiB .ppx file, this is almost essential).
I'm aware that a feature that dumps the nodes to the console already
exists, but for large units, like the aforementioned System unit, this is
grossly impractical because of the sheer volume of data that's printed.
Note that currently only procedures and functions are dumped to the .ppx
file - things like class declarations and global variables aren't dumped,
although being a debug-only feature, it's not overly critical. Similarly,
if it comes across an assembler block node, the assembly code is only
dumped on x86 families at present. If anyone feels like adding extra
features to it, feel free.
I hope it proves useful for future compiler debugging and development.
Gareth aka. Kit
_______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org [1]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190206/ec40a716/attachment.html>
More information about the fpc-devel
mailing list