SystemTap 笔记 (11)—— 命令行参数

SystemTap使用$@传递命令行参数:$传递整数参数,@传递字符串参数。举例如下:

# cat test.stp
#!/usr/bin/stap

probe begin
{
        printf("arg1 is %d, arg2 is %s\n", $1, @2)
        exit()
}

执行如下:

 # ./test.stp 100 "test"
arg1 is 100, arg2 is test

参考资料:
Command-Line Arguments

 

发表评论

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.