-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
tracepoint: Support __data_loc fields in tracepoints #1542
Conversation
There's still one thing I'm really confused about. So the typical case works ok:
But printing the address fails:
As far as I can tell, the "-24+16 size 24" error is bogus. Instructions 3, 6 and 8 completely initialize the 24 byte region starting at -24 + 16 = -8. If anyone has ideas I would be ecstatic to hear them. |
Maybe its unhappy about adding ctx into the mix? The ir and output look valid in both cases, but this seems to fix it:
And this works too
But here it does an i16 load to avoid the masking:
|
Commenting out the ctx + offset fixed it for me. Not sure there's anything we can do from our side. It seems like a kernel issue to me. |
Chatted w/ Alexei. When we add an offset to ctx and store the result to the stack, the verifier thinks it's a register spill and doesn't let anyone read from the location on stack. I'm not sure that's what the correct behavior should be but it's the current limitation. We'll probably have to live with the unprintable data_loc integers. Shouldn't be too bad functionally b/c it's not like userspace could do anything with that pointer. Edit: there may be a kernel fix coming sometime. |
Just landed the new tuple code, so this might need a rebase |
It's unclear why the renaming exists. It's not like the renamed field name made __data_loc fields work properly. This makes things more predictable. Note that this will break the workaround described in bpftrace#999 .
Rebased. Also moved the type rewrite from semantic analyser into clang parser. Probably better to reduce the spread of the logic. Also made it easier to write a better clang parser test. |
This commit coordinates __data_loc annotation between the TracepointFormatParser and ClangParser. The next commit will use `Field::is_data_loc` to generate the proper code for field accesses.
This commit teaches codegen how to decode the __data_loc fields. Accessing `args->name`, where `name` is a __data_loc field now returns the address the data portion begins. We also have to do some hacky type rewriting in the semantic analyzer to have a wide enough integer to store pointers in. Not sure if there's a better way.
This PR teaches bpftrace to read
__data_loc
arguments from tracepoints.Note that this PR causes a minor compatibility break where fields previously
named
args->data_loc_name
are now namedargs->name
.This closes #385 . This supercedes #770 .
Checklist
docs/reference_guide.md
CHANGELOG.md