Emit preprocessor line annotations during tapset translation

Craig Ringer craig@2ndquadrant.com
Fri Jul 17 06:10:49 GMT 2020


Hi all

I'm thinking of patching the systemtap translator to inject preprocessor
annotations that add the original file and line numbers for compiler error
reporting. Like those used by gcc to report header file and line locations
during compilation of .c files.

This uses https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html .

Would that be of interest to others here?

I've taken a look at parse.cxx . As far as I can see, objects like "struct
macrodecl" have their own "const token* tok" array of "struct token", each
of which has a "source_loc location" member with "file" and "line" members.

I'm not sure how best to go about translating that in the output so that
the directives appear in the most meaningful places though. Ideas?

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise


More information about the Systemtap mailing list