How to debug the forest?
Mikael Morin
morin-mikael@orange.fr
Tue Sep 16 20:33:41 GMT 2025
Le 16/09/2025 à 21:07, Harald Anlauf a écrit :
> Hi All,
>
> when trying to debug the gfortran frontend, I often get lost in the
> forest: too much forest, trees everywhere, leaves, ...
>
> OK, seriously, what is an efficient way to debug under e.g. gdb,
> when there is code that uses macros on trees, like TREE_TYPE ()
> etc., without losing your sanity?
>
> I do know that there exists e.g. debug_tree, but this can dump a lot
> of stuff on me. And the comment at the top of gcc/print-tree.cc:
>
> /* Prints out tree in human readable form - GCC
>
> makes me feel non-human. :-(
>
> I was now thinking of writing helper functions, like:
>
I tend to use debug_generic_expr which is enough in the majority of cases.
There is a .gdbinit file in build/gcc that you can source in your gdb
session. It loads many shortcuts most of them coming from the template
gcc/gdbinit.in (have a look there, you may find some useful).
Otherwise I use the full data references which I pick from the macro
definitions. Not human-enough may be.
More information about the Fortran
mailing list