From 8dd569934c2019dff527f0587f3d809efeec7c03 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 10 Mar 2003 09:12:11 +0000 Subject: 2003-03-10 Roland McGrath * dlfcn/Makefile (libdl-routines): Add dladdr1. * dlfcn/dladdr1.c: New file. * dlfcn/dlfcn.h [__USE_GNU]: Declare dladdr1. [__USE_GNU] (RTLD_DL_SYMENT, RTLD_DL_LINKMAP): New enum constants. * elf/dl-addr.c (_dl_addr): Take new args, a struct link_map ** and a const ElfNN_Sym ** to fill in. * include/dlfcn.h: Update decl. Include . * dlfcn/dladdr.c (dladdr): Update caller. * malloc/mtrace.c (tr_where): Likewise. * sysdeps/generic/elf/backtracesyms.c: Likewise. * sysdeps/generic/elf/backtracesymsfd.c: Likewise. * dlfcn/Versions (libdl: GLIBC_2.3.3): New set, add dladdr1. * Versions.def (libdl): Define GLIBC_2.3.3 set. --- elf/dl-addr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'elf/dl-addr.c') diff --git a/elf/dl-addr.c b/elf/dl-addr.c index e560c74ab5..0b8328bf4d 100644 --- a/elf/dl-addr.c +++ b/elf/dl-addr.c @@ -1,5 +1,5 @@ /* Locate the shared object symbol nearest a given address. - Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1996-2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,7 +24,8 @@ int internal_function -_dl_addr (const void *address, Dl_info *info) +_dl_addr (const void *address, Dl_info *info, + struct link_map **mapp, const ElfW(Sym) **symbolp) { const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address); struct link_map *l, *match; @@ -93,6 +94,11 @@ _dl_addr (const void *address, Dl_info *info) || ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)) matchsym = (ElfW(Sym) *) symtab; + if (mapp) + *mapp = match; + if (symbolp) + *symbolp = matchsym; + if (matchsym) { /* We found a symbol close by. Fill in its name and exact address. */ -- cgit v1.2.3