Untitled
unknown
plain_text
a year ago
662 B
8
Indexable
include <stdio.h>
#include <unistd.h>
struct Point {
int x;
int y;
};
int baz(int a, char *s, struct Point p) {
printf("baz(%d, %s, {x=%d, y=%d})\n", a, s, p.x, p.y);
return p.x + p.y + a;
}
int main() {
struct Point p1 = {10, 20};
struct Point p2 = {30, 40};
struct Point p3 = {50, 60};
baz(1, "foo", p1);
sleep(1);
baz(2, "bar", p2);
sleep(1);
baz(3, "baz", p3);
return 0;
}
gcc -O0 -g -o app3 app3.c
sudo bpftrace -e '
struct Point { int x; int y; };
uprobe:./app3:baz {
$p = *(struct Point *)arg2;
printf("baz(a=%d, s=%s, p={x=%d, y=%d})\n", arg0, str(arg1), $p.x, $p.y);
}
' -c ./app3
Editor is loading...
Leave a Comment