feat(layers/dtrace): Support User Statically-Defined Tracing(aka USDT) on Linux#4053
Merged
feat(layers/dtrace): Support User Statically-Defined Tracing(aka USDT) on Linux#4053
Conversation
c48eab7 to
c2f0679
Compare
Xuanwo
reviewed
Jan 23, 2024
oowl
reviewed
Jan 23, 2024
6716317 to
653d889
Compare
Xuanwo
reviewed
Jan 23, 2024
…) on Linux Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
0964c56 to
ffe0794
Compare
Signed-off-by: Manjusaka <me@manjusaka.me>
Xuanwo
reviewed
Jan 24, 2024
core/src/layers/dtrace.rs
Outdated
| n | ||
| }) | ||
| .map_err(|e| { | ||
| probe_lazy!(opendal, blocking_read_complete_error, c_path.as_ptr()); |
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature is an experimental feature
TL;DR;
The PR will make the debug and tracing the opendal process easier in the Linux platform. The people can use so many modern tools like bpftrace to trace the internal state in the process
USDT is a way to allow people to pre-define some static hooks. Those hooks could be used to fetch some internal information when the process runs.
I will use this PR to describe the detailed behavior of the DTrace in the OpenDAL.
When people enabled
layers-dtracefeature and added the layer to their code like the following code:Then we compile the code, and use
readelf -n ${target_binary}to get the binary detail, we will find some information like following belowWe describe the offset, the argument of hook, and so many information else in each section of the text. For example, the
write_starthook, we can find the offset is0x00000000000fc6e5and we can use gdb to verify it.We will figure out the asm in 0x5555556506e5 is
NOP(the process virtual address started at 0x555555554000 on my machine, and 0x555555554000+0x00000000000fc6e5=0x5555556506e5). TheNOPinstruction code will be replaced by the interrupt code when the hook is attached (In x86_64, the interrupt code is INT3)We can also set a breakpoint at this address.
We will find the code paused on line 146 in dtrace.rs. This is exactly what we want
The USDT can help us debug it more easily and make it easier to trace it.
We can use many other tools to trace it.