diff options
author | Edgar E. Iglesias <edgar@axis.com> | 2012-10-09 12:16:52 +0200 |
---|---|---|
committer | Edgar E. Iglesias <edgar@axis.com> | 2012-10-15 09:33:10 +0200 |
commit | 11c3c3e28461886bb16c69c745b1fefa946c4d9f (patch) | |
tree | b576d9e81e166471420577014d5f69e4f972cae4 | |
parent | fd4b4ef0d4fbaf2039fac61764421e47cac2ca39 (diff) | |
download | ltrace-11c3c3e28461886bb16c69c745b1fefa946c4d9f.tar.gz |
Make finding the dynamic linkers debug area arch specfic
Make it possible for archs to override the lookup of the
dynamic linkers debug area.
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
-rw-r--r-- | backend.h | 11 | ||||
-rw-r--r-- | sysdeps/linux-gnu/proc.c | 12 |
2 files changed, 21 insertions, 2 deletions
@@ -312,6 +312,17 @@ void arch_dynlink_done(struct Process *proc); * ARCH_HAVE_SYMBOL_RET. It is called after a traced call returns. */ void arch_symbol_ret(struct Process *proc, struct library_symbol *libsym); + +/* This callback needs to be implemented if arch.h defines + * ARCH_HAVE_FIND_DL_DEBUG. + * It is called by generic code to find the address of the dynamic + * linkers debug structure. + * DYN_ADDR holds the address of the dynamic section. + * If the debug area is found, return 0 and fill in the address in *RET. + * If the debug area is not found, return a negative value. */ +int arch_find_dl_debug(struct Process *proc, arch_addr_t dyn_addr, + arch_addr_t *ret); + /* If arch.h defines ARCH_HAVE_FETCH_ARG, the following callbacks have * to be implemented: arch_fetch_arg_init, arch_fetch_arg_clone, * arch_fetch_arg_done, arch_fetch_arg_next and arch_fetch_retval. diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c index cc322fa..1dfcc7e 100644 --- a/sysdeps/linux-gnu/proc.c +++ b/sysdeps/linux-gnu/proc.c @@ -560,6 +560,15 @@ rdebug_bp_on_hit(struct breakpoint *bp, struct Process *proc) debug->state = rdbg.r_state; } +#ifndef ARCH_HAVE_FIND_DL_DEBUG +int +arch_find_dl_debug(struct Process *proc, arch_addr_t dyn_addr, + arch_addr_t *ret) +{ + return proc_find_dynamic_entry_addr(proc, dyn_addr, DT_DEBUG, ret); +} +#endif + int linkmap_init(struct Process *proc, arch_addr_t dyn_addr) { @@ -576,8 +585,7 @@ linkmap_init(struct Process *proc, arch_addr_t dyn_addr) } proc->debug = debug; - if (find_dynamic_entry_addr(proc, dyn_addr, DT_DEBUG, - &debug->debug_addr) == -1) { + if (arch_find_dl_debug(proc, dyn_addr, &debug->debug_addr) == -1) { debug(2, "Couldn't find debug structure!"); goto fail; } |