static inline int
get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
	       int *countp)
{
  unsigned long lo, hi, off;
  struct UPT_info *ui = arg;
  struct map_iterator mi;
  char path[PATH_MAX];
  unw_dyn_info_t *di;
  unw_word_t res;
  int count = 0;

  maps_init (&mi, ui->pid);
  while (maps_next (&mi, &lo, &hi, &off))
    {
      if (off)
	continue;

      if (ui->ei.image)
	{
	  munmap (ui->ei.image, ui->ei.size);
	  ui->ei.image = NULL;
	  ui->ei.size = 0;
	  /* invalidate the cache: */
	  ui->di_cache.start_ip = ui->di_cache.end_ip = 0;
	}

      if (elf_map_image (&ui->ei, path) < 0)
	/* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
	continue;

      Debug (16, "checking object %s\n", path);

      di = _UPTi_find_unwind_table (ui, as, path, lo, off);
      if (di)
	{
	  res = _Uia64_find_dyn_list (as, di, arg);
	  if (res && count++ == 0)
	    {
	      Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res);
	      *dil_addr = res;
	    }
	}
    }
  maps_close (&mi);
  *countp = count;
  return 0;
}
Ejemplo n.º 2
0
Archivo: ssDDM.c Proyecto: q3k/ski
static int
get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg)
{
  struct load_module *lm;
  unw_dyn_info_t di;
  unw_word_t res;
  int count = 0;

  for (lm = load_module_list; lm; lm = lm->next) {
      if (get_unwind_table(&di, as, lm) >= 0) {
	  res = _Uia64_find_dyn_list(as, &di, arg);
	  if (res && ++count == 0)
	      *dil_addr = res;
	  free(di.u.ti.table_data);
      }
  }
  return (count > 0) ? 0 : -UNW_ENOINFO;
}