How can I get the line number and file name from GCC tree.

Matthieu Moy Matthieu.Moy@imag.fr
Mon Dec 22 10:48:00 GMT 2003


Hi !

There is a feature I'm looking for mainly for debugging :

I have a GCC tree that I can print from GDB with debug_tree(t). What I
would like is  to be able to get  back-to-source information, ie which
file and at which line number is the source code which has been parsed
to produce this tree. 

I first tried someting like

void tree_linenb(tree t) {
   printf("Line %d\n", STMT_LINENO(t));
}

But it takes several seconds to answer. Strange ... 

And most important : I can't find the equivalent for the filename.

Thanks for your answers.

-- 
Matthieu



More information about the Gcc mailing list