1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-04-12 00:12:18 +02:00

(get_list_addr): New function.

(_UPT_get_dyn_info_list_addr): Factor platform-specific code into
	separate inline-function.  Enable that code for ia64 linux
	only (e.g., on HP-UX it needs to use dlmodinfo()).

(Logical change 1.218)
This commit is contained in:
mostang.com!davidm 2004-04-28 04:54:17 +00:00
parent 9b21d8edaf
commit f8bc3b80d1

View file

@ -25,28 +25,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "_UPT_internal.h" #include "_UPT_internal.h"
#ifdef UNW_TARGET_IA64 #if UNW_TARGET_IA64 && defined(__linux)
# include "elf64.h" # include "elf64.h"
# include "os-linux.h" # include "os-linux.h"
#endif
int static inline int
_UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
void *arg) int *countp)
{ {
#if UNW_TARGET_IA64
unsigned long lo, hi, off; unsigned long lo, hi, off;
struct UPT_info *ui = arg; struct UPT_info *ui = arg;
struct map_iterator mi; struct map_iterator mi;
char path[PATH_MAX]; char path[PATH_MAX];
unw_dyn_info_t *di; unw_dyn_info_t *di;
unw_word_t res; unw_word_t res;
#endif
int count = 0; int count = 0;
Debug (12, "looking for dyn_info list\n");
#if UNW_TARGET_IA64
maps_init (&mi, ui->pid); maps_init (&mi, ui->pid);
while (maps_next (&mi, &lo, &hi, &off, path, sizeof (path))) while (maps_next (&mi, &lo, &hi, &off, path, sizeof (path)))
{ {
@ -77,10 +71,25 @@ _UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr,
} }
} }
maps_close (&mi); maps_close (&mi);
*countp = count;
return 0;
}
#else #else
# warning Implement me, please. # warning Implement get_list_addr(), please.
#endif #endif
int
_UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr,
void *arg)
{
int count, ret;
Debug (12, "looking for dyn_info list\n");
if ((ret = get_list_addr (as, dil_addr, arg, &count)) < 0)
return ret;
/* If multiple dynamic-info list addresses are found, we would have /* If multiple dynamic-info list addresses are found, we would have
to determine which was is the one actually in use (since the to determine which was is the one actually in use (since the
dynamic name resolution algorithm will pick one "winner"). dynamic name resolution algorithm will pick one "winner").