尝试在ctxswitch中使用变量时出现Systemtap错误

时间:2020-06-26 02:08:40

标签: unix operating-system systemtap probing

我有以下代码,每当特定进程遇到上下文切换时,它们都应该打个招呼

global my_pid


probe begin
{
  my_pid = target()
  
  qsq_start("states")
  qs_wait("states")
}

probe scheduler.ctxswitch
{
  if (prev_pid == my_pid)
  {
    printf("Hello\n")
  }
  
  else if (next_pid == my_pid)
  {
    printf("hello\n")
  }
}

 probe scheduler.process_exit 
 { 
   if (pid() == my_pid)   {
     printf("Hello\n")  
   } 
 }
 
 probe end { printf("leaving probe\n") }

但是,当我尝试使用它执行

Terminal$ stap e1.stp -c pid

我明白了

semantic error: while processing probe kernel.function("context_switch@kernel/sched/core.c:2550") from: scheduler.ctxswitch from: scheduler.ctxswitch

semantic error: unable to find local 'new', [man error::dwarf] dieoffset 0x10edcf5 in kernel, near pc 0xffffffff81785691 in context_switch kernel/sched/core.c (alternatives: $next, $prev, $rq)): identifier '$new' at /usr/share/systemtap/tapset/linux/scheduler.stp:170:14
        source:         next_pid = $new->tgid
                                   ^

Pass 2: analysis failed.  [man error::pass2]

在线阅读后,我认为它与我使用的systemtap版本有关,但是这是大学提供的虚拟机,我不确定是否需要更新它。

0 个答案:

没有答案
相关问题