[llvm-dev] How to debug passes

Iulia Stirb via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 16 06:49:35 PDT 2019


Hi,
Could you please confirm the following steps for debugging a pass?
1. copy your pass into llvm/lib/Transforms/Hello/Hello.cpp
2. name you pass Hello
3. insert debug messages like:

    errs() << "Vis­iting func­tion " << F.get­Name();
4. get LLVM bitcode:    clang -O3 -emit-llvm hello.c -c -o hello.bc5. disassemble the bitcode:

    llvm-dis hel­lo.bc

6. run the pass on your program:
    
    opt -load lib­dum­my­pass.so -dum­my­pass hel­lo.ll

The above steps did not work because the last step does not display any error message that has been added in the pass.

Could you please help to debug the pass by displaying the error messages?
Thank you.
Kind regards,Iulia



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/21979f70/attachment.html>


More information about the llvm-dev mailing list