Skip to content

FATAL: BUG: Struct size mismatch: #2023

Answered by mmisono
dongho-jung asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is the size of "" is 64 (STRING_SIZE) but the size of comm is 16 (COMM_SIZE).
https://github.com/iovisor/bpftrace/blob/45d23c82c36d2467e322e96b532edee33720c997/src/ast/passes/semantic_analyser.cpp#L97 https://github.com/iovisor/bpftrace/blob/45d23c82c36d2467e322e96b532edee33720c997/src/ast/passes/semantic_analyser.cpp#L346

(The difference comes from the fact that type of "" is char * but the comm is `char[16].)

A workaround is using comm instead of "" in the BEGIN{}.
sudo bpftrace -e 'BEGIN {@prev = (comm,"")} u:/usr/lib/libc.so.6:printf,u:/usr/lib/libc.so.6:puts / @prev != (comm, str(arg0)) / { printf("%s %s: %s\n", probe, comm, str(arg0)); @prev = (comm, str(arg0)) }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dongho-jung
Comment options

Answer selected by dongho-jung
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants