Skip to content
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

i#5505 kernel trace: Add drpt2trace to decode PT traces #5515

Merged
merged 68 commits into from
Jul 6, 2022

Conversation

dolanzhao
Copy link
Contributor

@dolanzhao dolanzhao commented Jun 3, 2022

Adds a PT raw traces decoding library and a command-line tool for testing it:

  • Adds drpt2ir. It is a static library that can decode PT raw traces. The next PR will support converting PT raw traces to DynamoRIO's IR(instr_t).
  • Adds drpt2trace. It is a command-line tool that invokes drpt2ir and is used to test drpt2ir's decoding APIs. The current version can decode the PT raw traces and count the number of instructions.
  • Updates clients/drcachesim/CMakeLists.txt to support building drpt2ir and drpt2trace.
  • Updates suite/tests/CMakeLists.txt to add a simple test for drpt2trace. The simple trace data is recorded by perf.

Issue: #5505

Add Intel/libipt  as a submodule in third_party.

Issue #5505
Update CMakeLists.txt to support build libipt
Update core/CMakeList.txt to fix the issue that drdecode will build as an shared libary.

Issue #5505
drptpostprocessor is a command-line tool for decoding a PT trace, and converting it into an instruction-only memtrace composed of 'memref_t's.
This is the first version. It can decode PT trace and count the number of instructions in the whole trace.

Issue #5505
Add a simple test for drptpostprocessor.
The simple trace data is recorded by perf.

Issue #5505
ignore clang-format error in .gitsubmodule

Issue #5505
fix clang-format check fail on drptpostprocessor.c

Issue #5505
fix clang-format check fail in .gitsubmodule

Issue #5505
@derekbruening
Copy link
Contributor

Normally you would get the tests green before requesting a review so the code isn't changing during review.

@derekbruening
Copy link
Contributor

add to allowlist

fix clang-format check fail on drptpostprocessor.c

Issue #5505
.gitmodules Outdated Show resolved Hide resolved
@derekbruening
Copy link
Contributor

Normally you would get the tests green before requesting a review so the code isn't changing during review.

To my point, a new commit came in while I was looking at the diff...please re-request review when ready.

fix clang-format check fail on drptpostprocessor.c

Issue #5505
@dolanzhao
Copy link
Contributor Author

Normally you would get the tests green before requesting a review so the code isn't changing during review.

To my point, a new commit came in while I was looking at the diff...please re-request review when ready.

Sorry for that. I will re-request review when the clang-format cl is pass.

@derekbruening
Copy link
Contributor

Sorry for that. I will re-request review when the clang-format cl is pass.

I would suggest installing clang-format locally in your dev env.

@dolanzhao
Copy link
Contributor Author

Sorry for that. I will re-request review when the clang-format cl is pass.

I would suggest installing clang-format locally in your dev env.

I installed it. But I think I met an issue about clang-format. The issue is I add links in comment and wrap them with "clang-format off" and "clang format on". The clang-format check still failed. Do you know how to fix it?

/* Why we need to handle pending perf events?*/
/* clang-format off */
/* https://github.com/intel/libipt/blob/c848a85c3104e2f5780741f85de5c9e65476ece2/doc/man/pt_insn_next.3.md?plain=1#L207-L234 */
/* clang-format on */

@dolanzhao dolanzhao closed this Jun 6, 2022
adding parameters lets the tool set the image and its offset and extent.
@dolanzhao dolanzhao reopened this Jun 6, 2022
@dolanzhao
Copy link
Contributor Author

Update:
For offline decoding, if the trace data is not generated in the decoding machine, we need to provide the program's images to the decoder. So we need to add image files for the simple test case. And the sideband file only contains image mmap information and can be used when the tracer and decoder are working on the same machine. So I remove it.

  • Add three image files: hello, ld-2.33.so and libc-2.33.so
  • Remove the sideband file.

Issue: 5505

clients/drcachesim/drpt2trace/CMakeLists.txt Show resolved Hide resolved
clients/drcachesim/drpt2trace/drpt2trace.cpp Show resolved Hide resolved
clients/drcachesim/drpt2trace/drpt2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/drpt2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/drpt2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/drpt2trace.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
ext/droption/droption.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
ext/droption/droption.h Outdated Show resolved Hide resolved
ext/droption/droption.h Outdated Show resolved Hide resolved
ext/droption/droption.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.cpp Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
clients/drcachesim/drpt2trace/pt2ir.h Outdated Show resolved Hide resolved
@dolanzhao dolanzhao changed the title i#5505 kernel memtrace: Add drpt2trace to decode and count IntelPT trace data i#5505 kernel trace: Add drpt2trace to decode PT trace Jul 1, 2022
@dolanzhao dolanzhao changed the title i#5505 kernel trace: Add drpt2trace to decode PT trace i#5505 kernel trace: Add drpt2trace to decode PT traces Jul 1, 2022
@dolanzhao dolanzhao merged commit 841a2b0 into master Jul 6, 2022
@dolanzhao dolanzhao deleted the i5505-kernel-memtrace branch July 6, 2022 14:13
@dolanzhao dolanzhao restored the i5505-kernel-memtrace branch July 6, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants