[Ltrace-devel] [PATCH v1 4/6] mipsel: Add a MIPS specific find_dl_debug
edgar.iglesias at gmail.com
edgar.iglesias at gmail.com
Tue Oct 9 12:50:33 UTC 2012
From: "Edgar E. Iglesias" <edgar at axis.com>
MIPS dynamic loaders put the address of their debug areas
into an DT_MIPS_RLD_MAP entry instead of into the DT_DEBUG
entry.
Signed-off-by: Edgar E. Iglesias <edgar at axis.com>
---
sysdeps/linux-gnu/mipsel/arch.h | 1 +
sysdeps/linux-gnu/mipsel/plt.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/sysdeps/linux-gnu/mipsel/arch.h b/sysdeps/linux-gnu/mipsel/arch.h
index e9a8962..4fa3a93 100644
--- a/sysdeps/linux-gnu/mipsel/arch.h
+++ b/sysdeps/linux-gnu/mipsel/arch.h
@@ -39,6 +39,7 @@ struct arch_ltelf_data {
size_t mips_gotsym;
};
+#define ARCH_HAVE_FIND_DL_DEBUG
#define ARCH_HAVE_GET_SYMINFO
#define ARCH_HAVE_DYNLINK_DONE
#define ARCH_HAVE_ADD_PLT_ENTRY
diff --git a/sysdeps/linux-gnu/mipsel/plt.c b/sysdeps/linux-gnu/mipsel/plt.c
index 6684867..f49f04f 100644
--- a/sysdeps/linux-gnu/mipsel/plt.c
+++ b/sysdeps/linux-gnu/mipsel/plt.c
@@ -84,6 +84,29 @@ sym2addr(Process *proc, struct library_symbol *sym) {
return (void *)ret;;
}
+/* Address of run time loader map, used for debugging. */
+#define DT_MIPS_RLD_MAP 0x70000016
+int
+arch_find_dl_debug(struct Process *proc, arch_addr_t dyn_addr,
+ arch_addr_t *ret)
+{
+ arch_addr_t rld_addr;
+ int r;
+
+ /* MIPS puts the address of the r_debug structure into the
+ * DT_MIPS_RLD_MAP entry instead of into the DT_DEBUG entry. */
+ r = proc_find_dynamic_entry_addr(proc, dyn_addr,
+ DT_MIPS_RLD_MAP, &rld_addr);
+ if (r == 0) {
+ if (umovebytes(proc, rld_addr,
+ ret, sizeof *ret) != sizeof *ret) {
+ r = -1;
+ }
+ }
+ return r;
+}
+
+
/*
* MIPS doesn't have traditional got.plt entries with corresponding
* relocations.
--
1.7.8.6
More information about the Ltrace-devel
mailing list