// Prints backtrace from lib through exe twice using diffent ustack functions.
// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so

global hits = 0;

probe process(@1).function("main_func")
{
  if (hits == 0)
    {
      log("print_ubacktrace exe 0");
      print_ubacktrace();
      hits++;
    }
  else if (hits == 1)
    {
      log("print_usyms exe 1");
      print_usyms(ubacktrace());
      hits++;
    }
}

probe process(@2).function("lib_func")
{
  if (hits == 2)
    {
      log("print_ubacktrace lib 2");
      print_ubacktrace();
      hits++;
    }
  else if (hits == 3)
    {
      log("print_usyms lib 3");
      print_usyms(ubacktrace());
      hits++;
    }
}
