Implement dladdr() (partially)

Note that this always returns with dli_sname and dli_saddr set to NULL,
indicating no symbol matching addr could be found.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Jon Turney
2017-03-06 18:30:45 +00:00
parent 51a993c266
commit c8432a01c8
6 changed files with 61 additions and 1 deletions

View File

@@ -9,6 +9,9 @@ details. */
#ifndef _DLFCN_H
#define _DLFCN_H
#include <sys/cdefs.h>
#include <limits.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,6 +45,21 @@ extern void dlfork (int);
#define RTLD_DEEPBIND 32 /* Place lookup scope so that this lib is */
/* preferred over global scope. */
#if __GNU_VISIBLE
typedef struct Dl_info Dl_info;
struct Dl_info
{
char dli_fname[PATH_MAX]; /* Filename of defining object */
void *dli_fbase; /* Load address of that object */
const char *dli_sname; /* Name of nearest lower symbol */
void *dli_saddr; /* Exact value of nearest symbol */
};
extern int dladdr (const void *addr, Dl_info *info);
#endif
#ifdef __cplusplus
}
#endif