Howto dump syntax tree of erroneous program?
Bob Gustafson
bobgus@rcn.com
Fri Nov 26 19:16:00 GMT 2004
I have a heavily templated C++ program (w/ macros too), written by
someone else, which compiles and runs using an earlier version of g++
(but not by me).
I have managed to find a number of tweeks (this-> additions) which
enable the compile to move along. However, I am stumped at the moment.
I have used -E, -Q, -dy, and -save-temps options to g++, but the info
obtained is not quite enough. I could use something that would dump the
source code file name, line number, name of syntactic element observed
(e.g., template, non-type template-parameter, template specialization,
etc.) and the source text snippet at that point.
This is just an aid so that I can be sure that the compiler and I are
thinking about the same thing in the same way.
The output could be spit out as an xml file. XSLT post-processor tools
would spring up to handle that format.
Does this exist already? If not, what piece of gcc compiler code would I
hack to product this output?
It appears as though there might be some promising code chunks in gcc/cp
(parser.c, semantics.c, ..). Would these be a good starting point?
Thanks for any replies.
BobG
More information about the Gcc
mailing list