mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibC+LibELF: Implement dladdr()
This implements the dladdr() function which lets the caller look up the symbol name, symbol address as well as library name and library base address for an arbitrary address.
This commit is contained in:
parent
f82aa87d14
commit
89a38b72b7
Notes:
sideshowbarker
2024-07-18 12:43:58 +09:00
Author: https://github.com/gunnarbeutner
Commit: 89a38b72b7
Pull-request: https://github.com/SerenityOS/serenity/pull/7844
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/awesomekling
5 changed files with 73 additions and 0 deletions
|
@ -60,3 +60,15 @@ void* dlsym(void* handle, const char* symbol_name)
|
|||
}
|
||||
return result.value();
|
||||
}
|
||||
|
||||
int dladdr(void* addr, Dl_info* info)
|
||||
{
|
||||
auto result = __dladdr(addr, info);
|
||||
if (result.is_error()) {
|
||||
// FIXME: According to the man page glibc does _not_ make the error
|
||||
// available via dlerror(), however we do. Does this break anything?
|
||||
store_error(result.error().text);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue