Split arch_translate_address into this and arch_translate_address_dyn
The former is called when ltelf is available. The latter in dynamic context
when ltelf is not necessary anymore (or if the data is necessary, it will
have been copied out to struct library).
diff --git a/ltrace-elf.c b/ltrace-elf.c
index 19f1c64..a311c5f 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -618,23 +618,13 @@
* translate those. */
if (secflags[sym.st_shndx] & SHF_EXECINSTR) {
naddr = addr;
- } else if (arch_translate_address(proc, addr, &naddr) < 0) {
+ } else if (arch_translate_address(lte, addr, &naddr) < 0) {
fprintf(stderr,
"couldn't translate address of %s@%s: %s\n",
name, lib->soname, strerror(errno));
continue;
}
- /* If the translation actually took place, and wasn't
- * a no-op, then bias again. XXX We shouldn't apply
- * second bias for libraries that were open at the
- * time that we attached. In fact what we should do
- * is look at each translated address, whether it
- * falls into a SHF_EXECINSTR section. If it does,
- * it's most likely already translated. */
- if (addr != naddr)
- naddr += lte->bias;
-
char *full_name;
if (lib->type != LT_LIBTYPE_MAIN) {
full_name = malloc(strlen(name) + 1 + lib_len + 1);
@@ -742,7 +732,7 @@
/* XXX The double cast should be removed when
* target_address_t becomes integral type. */
target_address_t entry = (target_address_t)(uintptr_t)lte.entry_addr;
- if (arch_translate_address(proc, entry, &entry) < 0)
+ if (arch_translate_address(<e, entry, &entry) < 0)
goto fail;
/* XXX The double cast should be removed when