#! stap -p2

global ar1, ar2

function printk (s:string) { return 0 } # to become a built-in

function search (key) 
{
  if (key in ar1)
    { ar1[key] ++; return ar2[ar1[key]] }
  else
    return "no can do"  # implies ar2[]: string
}

probe begin /* syscall("zamboni") */
{
  tgid=0
  pid=0
  tid=0
  ar2[tid] = sprint (tgid);
  search (pid)
}

probe end
{
  # for (key in ar2)
  if (key in ar2)
    printk ("this: " . sprint (key) . " was " . ar2[key])
}
