On Sun, Nov 11, 2018 at 11:37:57AM -0700, Martin Sebor wrote: > One other high-level comment: a more powerful interface to > variable tracing than annotating declarations in the source > would be to provide either the names of the symbols to trace > on the command line or in an external file. That way tracing > could be enabled for objects and types declared in read-only > files (such as system headers), and would let the user more > easily experiment with annotations.
For variables/functions if you add at the end of the source file typeof(foo) __attribute__(("vartrace")); it should enable it in theory (haven't tested) for both variables or functions. Not sure about types, probably not, but that might not be needed. But it has to be at the end of the file, so -include doesn't work. If an -include-after would be added to the preprocessor it would work. > This could be in addition to the attributes, and would require > coming up with a way of identifying symbols with internal or > no linkage, such as local variables, and perhaps also function Individual local variables are hard, but you could likely enable tracing for everything in the function with the attribute trick above. -Andi