Untitled

 avatar
unknown
plain_text
10 months ago
421 B
9
Indexable
#include <stdio.h>
#include <unistd.h>

int foo(int x) {
    printf("foo(%d)\n", x);
    return x * 2;
}

int main() {
    for (int i = 1; i <= 5; i++) {
        int y = foo(i);
        printf("result=%d\n", y);
        sleep(1);
    }
    return 0;
}


gcc -O0 -g -o app app.c


sudo bpftrace -e 'uprobe:./app:foo { printf("foo called with x=%d\n", arg0); }  uretprobe:./app:foo { printf("EXIT foo -> %d\n", retval); }'
Editor is loading...
Leave a Comment