6#ifndef __LIBDRAGON_DLFCN_H
7#define __LIBDRAGON_DLFCN_H
14#define RTLD_GLOBAL 0x1
18#define RTLD_NODELETE 0x2
20#define RTLD_NOLOAD 0x4
23#define RTLD_DEFAULT ((void *)-1)
25#define RTLD_NEXT ((void *)-2)
47".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n"
49".ascii \"gdb.inlined-script-dso-autoload\\n\"\n"
50".ascii \"import gdb\\n\"\n"
51".ascii \"class BreakpointDsoLoad(gdb.Breakpoint):\\n\"\n"
52".ascii \" def stop(self):\\n\"\n"
53".ascii \" frame = gdb.selected_frame()\\n\"\n"
54".ascii \" src_elf = gdb.execute('printf \\\"%s\\\", module->src_elf', False, True)\\n\"\n"
55".ascii \" prog_base = int(gdb.execute('printf \\\"%x\\\", module->prog_base', False, True), 16)\\n\"\n"
56".ascii \" print(\\\"Loading overlay: \\\", src_elf, \\\"(text:\\\", hex(prog_base), \\\")\\\")\\n\"\n"
57".ascii \" gdb.execute(\\\"add-symbol-file -readnow \\\" + src_elf + \\\" \\\" + hex(prog_base), False, True)\\n\"\n"
58".ascii \" return False\\n\"\n"
59".ascii \"class BreakpointDsoFree(gdb.Breakpoint):\\n\"\n"
60".ascii \" def stop(self):\\n\"\n"
61".ascii \" frame = gdb.selected_frame()\\n\"\n"
62".ascii \" src_elf = gdb.execute('printf \\\"%s\\\", module->src_elf', False, True)\\n\"\n"
63".ascii \" prog_base = int(gdb.execute('printf \\\"%x\\\", module->prog_base', False, True), 16)\\n\"\n"
64".ascii \" print(\\\"Unloading overlay: \\\", src_elf, \\\"(text:\\\", hex(prog_base), \\\")\\\")\\n\"\n"
65".ascii \" gdb.execute(\\\"remove-symbol-file -a \\\" + hex(prog_base), False, True)\\n\"\n"
66".ascii \" return False\\n\"\n"
67".ascii \"bp_load = BreakpointDsoLoad(\\\"__dl_insert_module\\\")\\n\"\n"
68".ascii \"bp_load.silent = True\\n\"\n"
69".ascii \"bl_free = BreakpointDsoFree(\\\"__dl_remove_module\\\")\\n\"\n"
70".ascii \"bl_free.silent = True\\n\"\n"
84void *
dlopen(
const char *filename,
int mode);
93void *
dlsym(
void *handle,
const char *symbol);
void * dli_saddr
Exact address of symbol named in dli_sname.
Definition dlfcn.h:36
const char * dli_sname
Name of symbol whose definition overlaps addr.
Definition dlfcn.h:34
const char * dli_fname
Pathname of shared object that contains address.
Definition dlfcn.h:30
void * dli_fbase
Base address at which shared object is loaded.
Definition dlfcn.h:32
dl_addr info structure
Definition dlfcn.h:28
void * dlopen(const char *filename, int mode)
Open dynamic library.
Definition dlfcn.c:401
char * dlerror(void)
Return last error that occurred in dynamic linker.
Definition dlfcn.c:630
void * dlsym(void *handle, const char *symbol)
Grab symbol from loaded dynamic library.
Definition dlfcn.c:466
int dladdr(const void *addr, Dl_info *info)
Convert address to symbol.
Definition dlfcn.c:595
int dlclose(void *handle)
Close loaded dynamic library.
Definition dlfcn.c:569