Example #1
0
File: ssDDM.c Project: q3k/ski
static int
find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
		int need_unwind_info, void *arg)
{
    unw_dyn_info_t di;
    int ret;

    if (get_unwind_info (&di, as, ip) < 0)
	return -UNW_ENOINFO;

#ifdef UNWIND_DEBUG
    fprintf(stderr, "find_proc_info()\n\tip=%llx, [0x%llx-0x%llx)\n"
	    "\tgp=0x%llx segbase=0x%llx\n"
	    "\ttable=%p, table_len=%llu\n",
	    (long long) ip,
	    (long long) di.start_ip, (long long) di.end_ip,
	    (long long) di.gp, (long long) di.u.ti.segbase,
	    di.u.ti.table_data, (long long) di.u.ti.table_len);
#endif

    ret = _Uia64_search_unwind_table (as, ip, &di, pi, need_unwind_info, arg);
#ifdef UNWIND_DEBUG
    fprintf (stderr, " %llx-%llx gp=%llx info=%p sz=%d ret=%d\n",
	     pi->start_ip, pi->end_ip, pi->gp, pi->unwind_info,
	     pi->unwind_info_size, ret);
#endif
    return ret;
}
Example #2
0
static int
remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
                       int need_unwind_info, void *arg)
{
  Debug (3, "called, as %p, ip 0x%llx, need_unwind_info %d\n", as, (long long) ip, need_unwind_info);

  unw_fuchsia_info_t* cxt = arg;
  int ret;

  ret = get_unwind_info (cxt, as, ip);
  if (ret < 0)
  {
    Debug (3, "get_unwind_info failed: %d\n", ret);
    return -UNW_ENOINFO;
  }

  ret = -UNW_ENOINFO;
  if (ret == -UNW_ENOINFO && cxt->edi.di_cache.format != -1)
    ret = dwarf_search_unwind_table (as, ip, &cxt->edi.di_cache, pi,
                                     need_unwind_info, arg);
  if (ret == -UNW_ENOINFO && cxt->edi.di_debug.format != -1)
    ret = dwarf_search_unwind_table (as, ip, &cxt->edi.di_debug, pi,
                                     need_unwind_info, arg);

  Debug (3, "returning %d\n", ret);
  return ret;
}
int
_UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
		     int need_unwind_info, void *arg)
{
  struct UPT_info *ui = arg;
  int ret = -UNW_ENOINFO;

  if (get_unwind_info (&ui->edi, ui->pid, as, ip, arg) < 0)
    return -UNW_ENOINFO;

#if UNW_TARGET_IA64
  if (ui->edi.ktab.format != -1)
    {
      /* The kernel unwind table resides in local memory, so we have
	 to use the local address space to search it.  Since
	 _UPT_put_unwind_info() has no easy way of detecting this
	 case, we simply make a copy of the unwind-info, so
	 _UPT_put_unwind_info() can always free() the unwind-info
	 without ill effects.  */
      ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi,
				      need_unwind_info, arg);
      if (ret >= 0)
	{
	  if (!need_unwind_info)
	    pi->unwind_info = NULL;
	  else
	    {
	      void *mem = malloc (pi->unwind_info_size);

	      if (!mem)
		return -UNW_ENOMEM;
	      memcpy (mem, pi->unwind_info, pi->unwind_info_size);
	      pi->unwind_info = mem;
	    }
	}
    }
#endif

  if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1)
    ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache,
				    pi, need_unwind_info, arg);

#if UNW_TARGET_ARM
  if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1)
    ret = tdep_search_unwind_table (as, ip, &ui->edi.di_arm, pi,
                                    need_unwind_info, arg);
#endif

  if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1)
    ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi,
				    need_unwind_info, arg);

  return ret;
}