[llvm-dev] How to debug passes
Andrzej Warzynski via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 17 00:44:52 PDT 2019
Hi Iulia,
You can skip step 5 - it's not required. opt will happily work with *.ll
as well as *.bc files. Since textual form _is_ much easier to read for
humans, you can generate it directly in step 4:
clang -O3 -emit-llvm -S hello.c -c -o hello.ll
Otherwise your steps look correct (assuming that when registering your
pass with RegisterPass<> you used 'dummypass' as the name for your
pass). Did you verify that hello.ll contains any functions? And have you
tried similar steps with the Hello pass?
-Andrzej
On 16/09/2019 14:49, Iulia Stirb via llvm-dev wrote:
> 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() << "Visiting function " << F.getName();|
> |
> |
> ||4. get LLVM bitcode:
> |
>
> clang -O3 -emit-llvm hello.c -c -o hello.bc
>
> |
>
> |5. disassemble the bitcode:
>
> | llvm-dis hello.bc|
>
> 6. |run the pass on your program:
>
> opt -load libdummypass.so -dummypass hello.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
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the llvm-dev
mailing list