Example #1
0
HIDDEN int
x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
  struct cursor *c = (struct cursor *) cursor;
  ucontext_t *uc = c->uc;

  /* Ensure c->pi is up-to-date.  On x86, it's relatively common to be
     missing DWARF unwind info.  We don't want to fail in that case,
     because the frame-chain still would let us do a backtrace at
     least.  */
  dwarf_make_proc_info (&c->dwarf);

  if (unlikely (c->sigcontext_format != X86_SCF_NONE))
    {
#if (!HAVE_SGX)
      struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;

      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
      sigreturn (sc);
#endif
    }
  else
    {
      Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
      setcontext (uc);
    }
  return -UNW_EINVAL;
}
Example #2
0
HIDDEN int
x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
  struct cursor *c = (struct cursor *) cursor;
  ucontext_t *uc = c->uc;

  /* Ensure c->pi is up-to-date.  On x86, it's relatively common to be
     missing DWARF unwind info.  We don't want to fail in that case,
     because the frame-chain still would let us do a backtrace at
     least.  */
  dwarf_make_proc_info (&c->dwarf);

  if (c->sigcontext_format == X86_SCF_NONE) {
      Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
      setcontext (uc);
      abort();
  } else if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) {
      struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;

      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
      sigreturn((ucontext_t *)((const char *)sc + FREEBSD_SC_UCONTEXT_OFF));
      abort();
  } else {
      Debug (8, "resuming at ip=%x for sigcontext format %d not implemented\n",
      c->dwarf.ip, c->sigcontext_format);
      abort();
  }
  return -UNW_EINVAL;
}
Example #3
0
PROTECTED int
unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
{
  struct cursor *c = (struct cursor *) cursor;

  if (dwarf_make_proc_info (&c->dwarf) < 0)
    {
      /* On x86-64, some key routines such as _start() and _dl_start()
	 are missing DWARF unwind info.  We don't want to fail in that
	 case, because those frames are uninteresting and just mark
	 the end of the frame-chain anyhow.  */
      memset (pi, 0, sizeof (*pi));
      pi->start_ip = c->dwarf.ip;
      pi->end_ip = c->dwarf.ip + 1;
      return 0;
    }
  *pi = c->dwarf.pi;
  return 0;
}
Example #4
0
int
unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
{
  struct cursor *c = (struct cursor *) cursor;
  int ret;

  ret = dwarf_make_proc_info (&c->dwarf);

  if (ret < 0)
  {
    /* On Tilegx, some routines i.e. _start() etc has no dwarf info.
       Just simply mark the end of the frames. */
    memset (pi, 0, sizeof (*pi));
    pi->start_ip = c->dwarf.ip;
    pi->end_ip = c->dwarf.ip + 1;
    return 0;
  }

  *pi = c->dwarf.pi;
  return 0;
}