[llvm-dev] gdb debug llvm pass

John Criswell via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 11 07:47:07 PDT 2016

On 7/11/16 8:46 AM, 李阳 via llvm-dev wrote:
> 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?

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:


For more information on how to use gdb, see the documentation for gdb at 


John Criswell

> Thanks very much!
> Best,
> liyang
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

John Criswell
Assistant Professor
Department of Computer Science, University of Rochester

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160711/5b5f6f7d/attachment.html>

More information about the llvm-dev mailing list