Debugging LLVM opt pass

What would be the recommended way to debug LLVM opt pass? Is there any way to perform source level debugging on a particular opt pass?


Compile all sources in DEBUG mode. Then you can run opt in gdb for instance, set command line arguments using "set args" and set a breakpoint using "break file:linenum".

This also works for debugging dynamically linked libraries loaded
with the -load option of opt.


Gang-Ryung Uh wrote: