>>>>> "Basile" == Basile STARYNKEVITCH <bas...@starynkevitch.net> writes:
Hi Basile. Basile> I added as a turorial on the wiki, a small MELT pass which warns Basile> against fprintf(stdout, ...) in the compiled code. Basile> For GCC hackers, is the page Basile> http://gcc.gnu.org/wiki/writing%20a%20pass%20in%20MELT Basile> clear enough? I've been looking for a very simple way to do some kinds of static analysis on gdb, so today I tried building the MELT branch in hopes it would serve this need. Unfortunately, it didn't compile. With C++ enabled, I got this failure: /space/tromey/MELT/gcc/libstdc++-v3/include/precompiled/stdc++.h:98:18: fatal error: chrono: No such file or directory With just C enabled, I got: make[2]: *** No rule to make target `install-melt-headers', needed by `install'. Stop. make[2]: Leaving directory `/space/tromey/MELT/build/gcc' In both cases I just configured with --disable-bootstrap --enable-melt, plus the appropriate --enable-langauges option. This is on x86 F11. Basile> (of course, the pass implementation is imperfect, but I have hard time Basile> finding good *small* examples). My gdb examples involve finding broken code that can't be diagnosed by the compiler. Most of my examples are simple, but also actually useful. For example, gdb has function that in the past could return null, but which now cannot. So, I'd like to find all places where the return result is checked. Or, gdb has a TRY_CATCH macro which expands to a couple of nested loops. It is not ok to 'return' or 'goto' from inside the inner loop, as this causes hard-to-find bugs. So, it would be nice to find any place that tries this. Or, there is a data type in gdb that used to be freed using 'xfree', but which now requires a special function to be called instead. So, it would be nice to find any place where xfree is passed an argument of this type. Etc. For my purposes, any kind of simple analysis pass that is simple to hack and doesn't require me to learn too much would be ideal. Tom