systemtap打印函数调用和参数取值

 

打印某文件内所有参数和入参

#!/usr/bin/stap

probe process("/usr/bin/jmy_app").function("*@my_app.c").call {
        printf("Function %s called with parameters : %s\n", ppfunc(), $$parms)
}

 

打印特定函数的参数和入参

#!/usr/bin/stap

probe process("/usr/bin/my_app").function("*my_app_func*").call {
        printf("Function %s called with parameters arg1: %d, arg2: %d\n", ppfunc(), $arg1, $arg2)
        printf("Function %s called with parameters : %s\n", ppfunc(), $$parms)
}

 

打印特定函数的调用栈

#! /usr/bin/env stap

probe process("/usr/bin/my_app").function("my_heap_free").call
{
        if (tid() != 115696 && tid() != 115883) {
                printf("%s\n", ppfunc())
                print_ubacktrace()
        }
}

 

 

https://sourceware.org/systemtap/examples/

posted on 2024-06-07 13:41  toong  阅读(242)  评论(0)    收藏  举报