suppose my app code looks like this:
假设我的应用程序代码是这样的:
#include <stdio.h>int global_var;void change_var(){ global_var++;} int main(void){ change_var(); retrun 0;}
Now, can You please tell me, if there is any possibilty to access global_var
in dtrace script and print it ?
现在,您能告诉我,是否有可能在dtrace脚本中访问global_var并打印它吗?
Best regards
致以最亲切的问候
1 个解决方案
#1
2
You can, but you have to know the variable's address. Your D would resemble
你可以,但是你必须知道变量的地址。你的D会像
self->kp = (int *) copyin(<address>, sizeof (int));printf("global_var = 0x%d\n", *self->kp)
#1
2
You can, but you have to know the variable's address. Your D would resemble
你可以,但是你必须知道变量的地址。你的D会像
self->kp = (int *) copyin(<address>, sizeof (int));printf("global_var = 0x%d\n", *self->kp)