gdb debug llvm pass

Hi all,

Since my pass doesn’t work right, I follow the guide [Writing an LLVM Pass: Using GDB with dynamically loaded passes] to debug my pass.

However, I succeed to meet the step: the opt stops in the PassManager::run method, I have no idea about setting breakpoints in my pass.These section is not detailed. Could anyone spare some guide?

Thanks very much!


This part of the document assumes that you are familiar with using gdb to set breakpoints; it’s really there just to describe the less-obvious solution of setting breakpoints in dynamically loaded code. According to the document, once you hit a breakpoint in PassManager::run, you can then set a break point for a method or function in your pass. For example, if your pass is named llvm::MyPass, then you can use: break llvm::MyPass::runOnModule … to set up a break point in your pass’s runOnModule() method. To get opt running again so that it will eventually run your pass and hit the breakpoint, use the continue command: continue For more information on how to use gdb, see the documentation for gdb at . Regards, John Criswell