diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 5a3ce5c202d..89098c21e60 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -24,6 +24,10 @@ dyn_cast<> templates
+ +
+ ... + DEBUG(std::cerr << "No debug type\n"); + #undef DEBUG_TYPE + #define DEBUG_TYPE "foo" + DEBUG(std::cerr << "'foo' debug type\n"); + #undef DEBUG_TYPE + #define DEBUG_TYPE "bar" + DEBUG(std::cerr << "'bar' debug type\n"); + #undef DEBUG_TYPE + #define DEBUG_TYPE "" + DEBUG(std::cerr << "No debug type (2)\n"); + ... +
+ +Then you can run your pass like this:
+ +
+ $ opt < a.bc > /dev/null -mypass + <no output> + $ opt < a.bc > /dev/null -mypass -debug + No debug type + 'foo' debug type + 'bar' debug type + No debug type (2) + $ opt < a.bc > /dev/null -mypass -debug-only=foo + No debug type + 'foo' debug type + No debug type (2) + $ opt < a.bc > /dev/null -mypass -debug-only=bar + No debug type + 'bar' debug type + No debug type (2) + $ +
+ +Of course, in practice, you should only set DEBUG_TYPE at the top of a +file, to specify the debug type for the entire module (if you do this before you +#include "Support/Debug.h", you don't have to insert the ugly +#undef's). Also, you should use names more meaningful that "foo" and +"bar", because there is no system in place to ensure that names do not conflict: +if two different modules use the same string, they will all be turned on when +the name is specified. This allows all, say, instruction scheduling debug +information to be enabled with -debug-type=InstrSched, even if the +source lives in multiple files.
+