Clean up libelfin_wrap functions api
This commit is contained in:
@@ -19,7 +19,7 @@ class LibelfinBinding
|
||||
uintptr_t loadoffset;
|
||||
};
|
||||
|
||||
DEBUGUS_EXTERNC void libelfin_wrap_get_syms(PLibelfinBinding *pbind, Symbols *syms)
|
||||
DEBUGUS_EXTERNC void libelfin_wrap_get_funcs(PLibelfinBinding pbind, Funcs *funcs)
|
||||
{
|
||||
LibelfinBinding *bind = (LibelfinBinding *)pbind;
|
||||
for (auto §ion : bind->elf.sections()) {
|
||||
@@ -27,18 +27,24 @@ DEBUGUS_EXTERNC void libelfin_wrap_get_syms(PLibelfinBinding *pbind, Symbols *sy
|
||||
for (auto sym : section.as_symtab()) {
|
||||
auto &d = sym.get_data();
|
||||
if (d.type() == elf::stt::func) {
|
||||
Symbol s = {
|
||||
Func f = {
|
||||
.name = (const char *)malloc(strlen(sym.get_name().c_str())+1),
|
||||
.addr = bind->loadoffset + (uintptr_t)d.value,
|
||||
.ai = libelfin_wrap_info_from_rip(pbind, (uintptr_t)d.value),
|
||||
};
|
||||
strcpy((char*)s.name, sym.get_name().c_str());
|
||||
da_append(syms, s);
|
||||
strcpy((char*)f.name, sym.get_name().c_str());
|
||||
da_append(funcs, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUGUS_EXTERNC uintptr_t libelfin_wrap_func_addr(PLibelfinBinding pbind, Func *f)
|
||||
{
|
||||
LibelfinBinding *bind = (LibelfinBinding *)pbind;
|
||||
return bind->loadoffset + f->ai->addr;
|
||||
}
|
||||
|
||||
DEBUGUS_EXTERNC PLibelfinBinding libelfin_wrap_get_binding(int fd, uintptr_t loadoffset)
|
||||
{
|
||||
return (PLibelfinBinding)new LibelfinBinding(fd, loadoffset);
|
||||
|
||||
Reference in New Issue
Block a user