Fix dladdr behaviour

* If dladdr can't find an exact match, it returns the nearest symbol
  less than the given address.
* If no suitable symbol can be found, but the address is within a
  loaded library, dladdr returns the library name and base address.

Signed-off-by: Ingo Weinhold <[email protected]>
This commit is contained in:
Hamish Morrison
2012-04-05 12:32:31 +02:00
committed by Ingo Weinhold
parent 71cfb0c8d0
commit 43e7b1c2b0
5 changed files with 55 additions and 41 deletions
@@ -36,8 +36,9 @@ struct rld_export {
status_t (*get_nth_image_symbol)(image_id imageID, int32 num,
char *symbolName, int32 *nameLength, int32 *symbolType,
void **_location);
status_t (*get_symbol_at_address)(void* address, image_id* _imageID,
char* nameBuffer, int32* _nameLength, int32* _type, void** _location);
status_t (*get_nearest_symbol_at_address)(void* address,
image_id* _imageID, char** _imagePath, char** _symbolName,
int32* _type, void** _location);
status_t (*test_executable)(const char *path, char *interpreter);
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
const char **_name);