Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我的应用程序代码如下所示:
#include <stdio.h> int global_var; void change_var(){ global_var++; } int main(void){ change_var(); retrun 0; }
现在,您能告诉我,是否可以global_var在 dtrace 脚本中访问并打印它?
global_var
最好的祝福
你可以,但你必须知道变量的地址。你的 D 会像
self->kp = (int *) copyin(<address>, sizeof (int)); printf("global_var = 0x%d\n", *self->kp)