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

WIP: Index anonymous structs #2874

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

rpigott
Copy link

@rpigott rpigott commented Dec 8, 2023

In #2863 I tried to use a fixed name for anonymous structs. That was no good so it was suggested to generate unique names for them. This does basically fix my original use case, but it doesn't seem to have the intended effect. I can still reproduce the crash in some of the test cases though I'm not sure why yet.

Also, some types that I don't think should be anonymous are identified as such:

$ sudo ./src/bpftrace -e 'uprobe:libc:getaddrinfo {printf("%d\n", args.hints->ai_protocol);}'
stdin:1:41-64: ERROR: Struct/union of type 'struct __anon_1' does not contain a field named 'ai_protocol'
uprobe:libc:getaddrinfo {printf("%d\n", args.hints->ai_protocol);}

but hints should have type struct addrinfo * [1].

Intended for #2867

[1] https://debuginfod.archlinux.org/buildid/8bfe03f6bf9b6a6e2591babd0bbc266837d8f658/debuginfo

Use an index to track anoynmous structs and unions, so they can have
unique names. This will allow bpftrace to handle such types without
barfing.
@rpigott rpigott marked this pull request as draft December 8, 2023 05:34
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.

None yet

1 participant