-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dynamic-cc instrumented prints nothing #62
Comments
Hey, thanks for posting this! Could you copy and paste all your commands so that I can reproduce this? Thanks, |
Thanks for replying! $ clang-13 -O1 -emit-llvm -c ../../inputs/input_for_cc.c -o input_for_cc.bc
$ opt-13 -enable-new-pm=0 -load ./libDynamicCallCounter.so -legacy-dynamic-cc input_for_cc.bc -o instrumented_bin
# running it on lli-13 prints nothing
$ lli-13 ./instrumented_bin
# running it on lli 15.0.0, which is built from source code, prints the following:
$ LLVM_PROJECT_DIR/build/bin/lli ./instrumented_bin
=================================================
LLVM-TUTOR: dynamic analysis results
=================================================
NAME #N DIRECT CALLS
-------------------------------------------------
foo 0
bar 0
fez 0
main 1 |
Thanks for sending this! Please try this for your first step (replace
You should get a good idea of what is happening by comparing the generate file before and after the change (you will want to add That's my bad - I need to update the README file. Sorry about it - I really appreciate you reporting this, thank you! -Andrzej |
I tried the change and it only makes =================================================
LLVM-TUTOR: dynamic analysis results
=================================================
NAME #N DIRECT CALLS
-------------------------------------------------
foo 13
bar 2
fez 1
main 1 But This seems to be caused by JIT. According to the release note, the default JIT engine is changed from Using |
Ah, now I see! Great find :) Annoyingly, I did encounter this myself when bumping to LLVM 13: b2f4d7b. So, the README needs updating :) Would you fancy creating a PR? And perhaps an end-to-end test? Thanks for digging into this and seeing it through - that's greatly appreciated! -Andrzej |
Oh, that's right! I didn't even think about checking the tests. I created a PR updating the README. But DynamicCallCounterTest1.ll does the testing already. Is that the end-to-end test you're talking about? |
Thanks for creating that PR! By "end-to-end" I meant a test that consumes a C file (instead of an LLVM file), so that it needs to run
This would be "end-to-end" in the sense that it wouldn't skip the Clang invocation. Perhaps not the best name! I guess that you could just update DynamicCallCounterTest1.ll to contain this run line:
That should just work ™️ 🤞🏻 :) I'm suggesting this as next time we will be able to use this test as a reference for people (i.e. something that definitely works as it's regularly being tested in the CI). -Andrzej |
Thanks for the detailed explanation! I've updated the test. Also, thanks for creating this awesome tutorial! -Yu |
I'm using llvm 13.0.1
After being instrumented by dynamic-cc, running the program in lli prints nothing.
But when I run the same program in lli 15.0.0, it prints as expected.
Anybody experienced same issue?
The text was updated successfully, but these errors were encountered: