Move target_address_t to arch.h, rename to arch_addr_t
Note that the placement under arch.h is currently conceptual only. Since
no backend defines ARCH_HAVE_ADDRESS_TYPES, it's actually in sysdep.h in
all cases.
diff --git a/backend.h b/backend.h
index 08306e1..29688ea 100644
--- a/backend.h
+++ b/backend.h
@@ -22,6 +22,8 @@
#define BACKEND_H
#include "forward.h"
+#include "sysdep.h"
+
#include <gelf.h>
enum process_status {
@@ -33,8 +35,6 @@
ps_other, /* Necessary other states can be added as needed. */
};
-typedef void *target_address_t;
-
/*
* This file contains documentation of back end interface. Some of
* these may be implemented on an OS level (i.e. they are the same
@@ -93,7 +93,7 @@
* XXX note that the IP must fit into an arch pointer. This prevents
* us to use 32-bit ltrace to trace 64-bit process, even on arches
* that would otherwise support this. Above we have a definition of
- * target_address_t. This should be converted to an integral type and
+ * arch_addr_t. This should be converted to an integral type and
* used for target addresses throughout. */
void *get_instruction_pointer(struct Process *proc);
@@ -183,7 +183,7 @@
/* Called at some point after we have attached to PROC. This callback
* should insert an introspection breakpoint for handling dynamic
* linker library loads. */
-int linkmap_init(struct Process *proc, target_address_t dyn_addr);
+int linkmap_init(struct Process *proc, arch_addr_t dyn_addr);
/* Called for breakpoints defined over an artificial symbol "". This
* can be used (like it is on Linux/GNU) to add more breakpoints
@@ -240,8 +240,8 @@
* otherwise. Sets *ENTRYP and *INTERP_BIASP to non-zero values if
* the corresponding value is known. Unknown values are set to 0. */
int process_get_entry(struct Process *proc,
- target_address_t *entryp,
- target_address_t *interp_biasp);
+ arch_addr_t *entryp,
+ arch_addr_t *interp_biasp);
/* This is called after the dynamic linker is done with the
* process startup. */
diff --git a/breakpoint.h b/breakpoint.h
index 0398072..7cd914e 100644
--- a/breakpoint.h
+++ b/breakpoint.h
@@ -81,7 +81,7 @@
* disabled. orig_value has to be set separately. CBS may be
* NULL. */
int breakpoint_init(struct breakpoint *bp, struct Process *proc,
- target_address_t addr, struct library_symbol *libsym);
+ arch_addr_t addr, struct library_symbol *libsym);
/* Make a clone of breakpoint BP into the area of memory pointed to by
* RETP. The original breakpoint was assigned to process OLD_PROC,
diff --git a/breakpoints.c b/breakpoints.c
index 8dc09df..e7120ee 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -20,7 +20,7 @@
#ifndef ARCH_HAVE_TRANSLATE_ADDRESS
int
arch_translate_address_dyn(struct Process *proc,
- target_address_t addr, target_address_t *ret)
+ arch_addr_t addr, arch_addr_t *ret)
{
*ret = addr;
return 0;
@@ -29,7 +29,7 @@
struct ltelf;
int
arch_translate_address(struct ltelf *lte,
- target_address_t addr, target_address_t *ret)
+ arch_addr_t addr, arch_addr_t *ret)
{
*ret = addr;
return 0;
@@ -95,7 +95,7 @@
static void
breakpoint_init_base(struct breakpoint *bp, struct Process *proc,
- target_address_t addr, struct library_symbol *libsym)
+ arch_addr_t addr, struct library_symbol *libsym)
{
bp->cbs = NULL;
bp->addr = addr;
@@ -110,7 +110,7 @@
* need process for anything. */
int
breakpoint_init(struct breakpoint *bp, struct Process *proc,
- target_address_t addr, struct library_symbol *libsym)
+ arch_addr_t addr, struct library_symbol *libsym)
{
breakpoint_init_base(bp, proc, addr, libsym);
return arch_breakpoint_init(proc, bp);
@@ -357,7 +357,7 @@
* for one structure. */
struct entry_breakpoint {
struct breakpoint super;
- target_address_t dyn_addr;
+ arch_addr_t dyn_addr;
};
static void
@@ -366,7 +366,7 @@
struct entry_breakpoint *bp = (void *)a;
if (proc == NULL || proc->leader == NULL)
return;
- target_address_t dyn_addr = bp->dyn_addr;
+ arch_addr_t dyn_addr = bp->dyn_addr;
delete_breakpoint(proc, bp->super.addr);
linkmap_init(proc, dyn_addr);
arch_dynlink_done(proc);
@@ -374,7 +374,7 @@
int
entry_breakpoint_init(struct Process *proc,
- struct entry_breakpoint *bp, target_address_t addr,
+ struct entry_breakpoint *bp, arch_addr_t addr,
struct library *lib)
{
int err;
diff --git a/library.c b/library.c
index 2bd7dbb..2ce3427 100644
--- a/library.c
+++ b/library.c
@@ -71,10 +71,10 @@
{
/* XXX this assumes that key is passed by value. */
union {
- target_address_t addr;
- unsigned int ints[sizeof(target_address_t)
+ arch_addr_t addr;
+ unsigned int ints[sizeof(arch_addr_t)
/ sizeof(unsigned int)];
- } u = { .addr = (target_address_t)key };
+ } u = { .addr = (arch_addr_t)key };
size_t i;
unsigned int h = 0;
@@ -87,8 +87,8 @@
target_address_cmp(const void *key1, const void *key2)
{
/* XXX this assumes that key is passed by value. */
- target_address_t addr1 = (target_address_t)key1;
- target_address_t addr2 = (target_address_t)key2;
+ arch_addr_t addr1 = (arch_addr_t)key1;
+ arch_addr_t addr2 = (arch_addr_t)key2;
return addr1 < addr2 ? 1
: addr1 > addr2 ? -1 : 0;
}
@@ -110,7 +110,7 @@
static void
private_library_symbol_init(struct library_symbol *libsym,
- target_address_t addr,
+ arch_addr_t addr,
const char *name, int own_name,
enum toplt type_of_plt)
{
@@ -130,7 +130,7 @@
int
library_symbol_init(struct library_symbol *libsym,
- target_address_t addr, const char *name, int own_name,
+ arch_addr_t addr, const char *name, int own_name,
enum toplt type_of_plt)
{
private_library_symbol_init(libsym, addr, name, own_name, type_of_plt);
@@ -358,5 +358,5 @@
enum callback_status
library_with_key_cb(struct Process *proc, struct library *lib, void *keyp)
{
- return lib->key == *(target_address_t *)keyp ? CBS_STOP : CBS_CONT;
+ return lib->key == *(arch_addr_t *)keyp ? CBS_STOP : CBS_CONT;
}
diff --git a/library.h b/library.h
index c387b02..876a533 100644
--- a/library.h
+++ b/library.h
@@ -33,13 +33,6 @@
LS_TOPLT_EXEC, /* PLT for this symbol is executable. */
};
-/* We should in general be able to trace 64-bit processes with 32-bit
- * ltrace. (At least PPC has several PTRACE requests related to
- * tracing 64-on-32, so presumably it should be possible.) But ltrace
- * is currently hopelessly infested with using void* for host address.
- * So keep with it, for now. */
-typedef void *target_address_t;
-
/* Dict interface. */
unsigned int target_address_hash(const void *key);
int target_address_cmp(const void *key1, const void *key2);
@@ -48,7 +41,7 @@
struct library_symbol *next;
struct library *lib;
const char *name;
- target_address_t enter_addr;
+ arch_addr_t enter_addr;
enum toplt plt_type;
char own_name;
struct arch_library_symbol_data arch;
@@ -57,7 +50,7 @@
/* Init LIBSYM. NAME will be freed when LIBSYM is destroyed if
* OWN_NAME. ARCH has to be initialized by a separate call. */
int library_symbol_init(struct library_symbol *libsym,
- target_address_t addr, const char *name, int own_name,
+ arch_addr_t addr, const char *name, int own_name,
enum toplt type_of_plt);
/* Copy library symbol SYM into the area pointed-to by RETP. Return 0
@@ -102,20 +95,20 @@
/* Unique key. Two library objects are considered equal, if
* they have the same key. */
- target_address_t key;
+ arch_addr_t key;
/* Address where the library is mapped. Two library objects
* are considered equal, if they have the same base. */
- target_address_t base;
+ arch_addr_t base;
/* Absolute address of the entry point. Useful for main
* binary, though I suppose the value might be useful for the
* dynamic linker, too (in case we ever want to do early
* process tracing). */
- target_address_t entry;
+ arch_addr_t entry;
/* Address of PT_DYNAMIC segment. */
- target_address_t dyn_addr;
+ arch_addr_t dyn_addr;
/* Symbols associated with the library. */
struct library_symbol *symbols;
@@ -171,14 +164,14 @@
/* A function that can be used as proc_each_library callback. Looks
* for a library with given base.
*
- * NOTE: The key is passed as a POINTER to target_address_t (that
- * because in general, target_address_t doesn't fit in void*). */
+ * NOTE: The key is passed as a POINTER to arch_addr_t (that
+ * because in general, arch_addr_t doesn't fit in void*). */
enum callback_status library_with_key_cb(struct Process *proc,
struct library *lib, void *keyp);
/* XXX this should really be in backend.h (as on pmachata/revamp
* branch), or, on this branch, in common.h. But we need
- * target_address_t (which should also be in backend.h, I reckon), so
+ * arch_addr_t (which should also be in backend.h, I reckon), so
* stuff it here for the time being. */
/* This function is implemented in the back end. It is called for all
* raw addresses as read from symbol tables etc. If necessary on
@@ -187,10 +180,10 @@
* success and a negative value on failure. */
struct ltelf;
int arch_translate_address(struct ltelf *lte,
- target_address_t addr, target_address_t *ret);
+ arch_addr_t addr, arch_addr_t *ret);
/* This is the same function as arch_translate_address, except it's
* used at the point that we don't have ELF available anymore. */
int arch_translate_address_dyn(struct Process *proc,
- target_address_t addr, target_address_t *ret);
+ arch_addr_t addr, arch_addr_t *ret);
#endif /* _LIBRARY_H_ */
diff --git a/ltrace-elf.c b/ltrace-elf.c
index 99d06d6..76ba3ae 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -86,8 +86,8 @@
goto fail;
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- target_address_t taddr = (target_address_t)
+ * arch_addr_t becomes integral type. */
+ arch_addr_t taddr = (arch_addr_t)
(uintptr_t)(addr + lte->bias);
if (library_symbol_init(libsym, taddr, name, 1, LS_TOPLT_EXEC) < 0) {
@@ -575,7 +575,7 @@
* each address, and replace name in libsym with a shorter variant if
* we find it. */
struct unique_symbol {
- target_address_t addr;
+ arch_addr_t addr;
struct library_symbol *libsym;
};
@@ -644,9 +644,9 @@
if (!filter_matches_symbol(options.static_filter, name, lib))
continue;
- target_address_t addr = (target_address_t)
+ arch_addr_t addr = (arch_addr_t)
(uintptr_t)(sym.st_value + lte->bias);
- target_address_t naddr;
+ arch_addr_t naddr;
/* On arches that support OPD, the value of typical
* function symbol will be a pointer to .opd, but some
@@ -766,18 +766,18 @@
}
/* 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;
+ * arch_addr_t becomes integral type. */
+ arch_addr_t entry = (arch_addr_t)(uintptr_t)lte.entry_addr;
if (arch_translate_address(<e, entry, &entry) < 0)
goto fail;
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- lib->base = (target_address_t)(uintptr_t)lte.base_addr;
+ * arch_addr_t becomes integral type. */
+ lib->base = (arch_addr_t)(uintptr_t)lte.base_addr;
lib->entry = entry;
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- lib->dyn_addr = (target_address_t)(uintptr_t)lte.dyn_addr;
+ * arch_addr_t becomes integral type. */
+ lib->dyn_addr = (arch_addr_t)(uintptr_t)lte.dyn_addr;
if (filter_matches_library(options.plt_filter, lib)
&& populate_plt(proc, filename, <e, lib) < 0)
diff --git a/proc.h b/proc.h
index 0dfa7db..03ef044 100644
--- a/proc.h
+++ b/proc.h
@@ -99,7 +99,7 @@
/* Dictionary of breakpoints (which is a mapping
* address->breakpoint). This is NULL for non-leader
* processes. XXX note that we store addresses (keys) by
- * value. That assumes that target_address_t fits in host
+ * value. That assumes that arch_addr_t fits in host
* pointer. */
Dict * breakpoints;
diff --git a/sysdeps/linux-gnu/arm/breakpoint.c b/sysdeps/linux-gnu/arm/breakpoint.c
index 5bcf86e..5748401 100644
--- a/sysdeps/linux-gnu/arm/breakpoint.c
+++ b/sysdeps/linux-gnu/arm/breakpoint.c
@@ -95,7 +95,7 @@
arch_breakpoint_init(struct Process *proc, struct breakpoint *sbp)
{
/* XXX That uintptr_t cast is there temporarily until
- * target_address_t becomes integral type. */
+ * arch_addr_t becomes integral type. */
int thumb_mode = ((uintptr_t)sbp->addr) & 1;
if (thumb_mode)
sbp->addr = (void *)((uintptr_t)sbp->addr & ~1);
diff --git a/sysdeps/linux-gnu/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c
index 370f43e..44cd056 100644
--- a/sysdeps/linux-gnu/ppc/fetch.c
+++ b/sysdeps/linux-gnu/ppc/fetch.c
@@ -54,7 +54,7 @@
typedef uint64_t gregs64_t[48];
struct fetch_context {
- target_address_t stack_pointer;
+ arch_addr_t stack_pointer;
int greg;
int freg;
int ret_struct;
@@ -159,10 +159,10 @@
else if (proc->e_machine == EM_PPC64 && a < 8)
a = 8;
- /* XXX Remove the two double casts when target_address_t
+ /* XXX Remove the two double casts when arch_addr_t
* becomes integral type. */
uintptr_t tmp = align((uint64_t)(uintptr_t)ctx->stack_pointer, a);
- ctx->stack_pointer = (target_address_t)tmp;
+ ctx->stack_pointer = (arch_addr_t)tmp;
if (valuep != NULL) {
valuep->where = VAL_LOC_INFERIOR;
@@ -409,9 +409,9 @@
value_init(valuep, proc, NULL, info, 0);
valuep->where = VAL_LOC_INFERIOR;
- /* XXX Remove the double cast when target_address_t
+ /* XXX Remove the double cast when arch_addr_t
* becomes integral type. */
- valuep->u.address = (target_address_t)(uintptr_t)addr;
+ valuep->u.address = (arch_addr_t)(uintptr_t)addr;
return 0;
}
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
index 944bd6a..c9ca458 100644
--- a/sysdeps/linux-gnu/ppc/plt.c
+++ b/sysdeps/linux-gnu/ppc/plt.c
@@ -104,7 +104,7 @@
}
int
-read_target_4(struct Process *proc, target_address_t addr, uint32_t *lp)
+read_target_4(struct Process *proc, arch_addr_t addr, uint32_t *lp)
{
unsigned long l = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
if (l == -1UL && errno)
@@ -117,7 +117,7 @@
}
static int
-read_target_8(struct Process *proc, target_address_t addr, uint64_t *lp)
+read_target_8(struct Process *proc, arch_addr_t addr, uint64_t *lp)
{
unsigned long l = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
if (l == -1UL && errno)
@@ -135,7 +135,7 @@
}
int
-read_target_long(struct Process *proc, target_address_t addr, uint64_t *lp)
+read_target_long(struct Process *proc, arch_addr_t addr, uint64_t *lp)
{
if (proc->e_machine == EM_PPC) {
uint32_t w;
@@ -223,7 +223,7 @@
* already. */
int
arch_translate_address_dyn(struct Process *proc,
- target_address_t addr, target_address_t *ret)
+ arch_addr_t addr, arch_addr_t *ret)
{
if (proc->e_machine == EM_PPC64) {
uint64_t value;
@@ -232,8 +232,8 @@
return -1;
}
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- *ret = (target_address_t)(uintptr_t)value;
+ * arch_addr_t becomes integral type. */
+ *ret = (arch_addr_t)(uintptr_t)value;
return 0;
}
@@ -243,11 +243,11 @@
int
arch_translate_address(struct ltelf *lte,
- target_address_t addr, target_address_t *ret)
+ arch_addr_t addr, arch_addr_t *ret)
{
if (lte->ehdr.e_machine == EM_PPC64) {
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
+ * arch_addr_t becomes integral type. */
GElf_Xword offset
= (GElf_Addr)(uintptr_t)addr - lte->arch.opd_base;
uint64_t value;
@@ -256,7 +256,7 @@
elf_errmsg(-1));
return -1;
}
- *ret = (target_address_t)(uintptr_t)(value + lte->bias);
+ *ret = (arch_addr_t)(uintptr_t)(value + lte->bias);
return 0;
}
@@ -509,8 +509,8 @@
}
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- target_address_t addr = (target_address_t)
+ * arch_addr_t becomes integral type. */
+ arch_addr_t addr = (arch_addr_t)
(uintptr_t)sym.st_value + lte->bias;
if (library_symbol_init(libsym, addr, sym_name, 1,
LS_TOPLT_EXEC) < 0)
@@ -533,7 +533,7 @@
* either can change. */
uint64_t l;
/* XXX double cast. */
- if (read_target_8(proc, (target_address_t)(uintptr_t)addr, &l) < 0) {
+ if (read_target_8(proc, (arch_addr_t)(uintptr_t)addr, &l) < 0) {
error(0, errno, "ptrace .plt slot value @%#" PRIx64, addr);
return -1;
}
@@ -621,9 +621,9 @@
}
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
+ * arch_addr_t becomes integral type. */
if (library_symbol_init(libsym,
- (target_address_t)(uintptr_t)plt_entry_addr,
+ (arch_addr_t)(uintptr_t)plt_entry_addr,
name, 1, LS_TOPLT_EXEC) < 0)
goto fail;
libsym->arch.plt_slot_addr = plt_slot_addr;
@@ -760,7 +760,7 @@
/* We need to install to the next instruction. ADDR points to
* a store instruction, so moving the breakpoint one
* instruction forward is safe. */
- target_address_t addr = get_instruction_pointer(proc) + 4;
+ arch_addr_t addr = get_instruction_pointer(proc) + 4;
leader->arch.dl_plt_update_bp = insert_breakpoint(proc, addr, NULL);
if (leader->arch.dl_plt_update_bp == NULL)
goto done;
@@ -784,8 +784,8 @@
jump_to_entry_point(struct Process *proc, struct breakpoint *bp)
{
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- target_address_t rv = (target_address_t)
+ * arch_addr_t becomes integral type. */
+ arch_addr_t rv = (arch_addr_t)
(uintptr_t)bp->libsym->arch.resolved_value;
set_instruction_pointer(proc, rv);
}
diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
index 0b734e4..2bb317f 100644
--- a/sysdeps/linux-gnu/ppc/trace.c
+++ b/sysdeps/linux-gnu/ppc/trace.c
@@ -94,14 +94,14 @@
#define BRANCH_MASK 0xfc000000
/* In plt.h. XXX make this official interface. */
-int read_target_4(struct Process *proc, target_address_t addr, uint32_t *lp);
+int read_target_4(struct Process *proc, arch_addr_t addr, uint32_t *lp);
int
arch_atomic_singlestep(struct Process *proc, struct breakpoint *sbp,
int (*add_cb)(void *addr, void *data),
void *add_cb_data)
{
- target_address_t ip = get_instruction_pointer(proc);
+ arch_addr_t ip = get_instruction_pointer(proc);
struct breakpoint *other = address2bpstruct(proc->leader, ip);
debug(1, "arch_atomic_singlestep pid=%d addr=%p %s(%p)",
@@ -129,7 +129,7 @@
debug(1, "singlestep over atomic block at %p", ip);
int insn_count;
- target_address_t addr = ip;
+ arch_addr_t addr = ip;
for (insn_count = 0; ; ++insn_count) {
addr += 4;
unsigned long l = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
@@ -149,7 +149,7 @@
int absolute = insn & 2;
/* XXX drop the following casts. */
- target_address_t branch_addr;
+ arch_addr_t branch_addr;
if (absolute)
branch_addr = (void *)(uintptr_t)immediate;
else
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index e7556f5..d05da13 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -288,7 +288,7 @@
}
static int
-fetch_dyn64(struct Process *proc, target_address_t *addr, Elf64_Dyn *ret)
+fetch_dyn64(struct Process *proc, arch_addr_t *addr, Elf64_Dyn *ret)
{
if (umovebytes(proc, *addr, ret, sizeof(*ret)) != sizeof(*ret))
return -1;
@@ -297,7 +297,7 @@
}
static int
-fetch_dyn32(struct Process *proc, target_address_t *addr, Elf64_Dyn *ret)
+fetch_dyn32(struct Process *proc, arch_addr_t *addr, Elf64_Dyn *ret)
{
Elf32_Dyn dyn;
if (umovebytes(proc, *addr, &dyn, sizeof(dyn)) != sizeof(dyn))
@@ -312,14 +312,14 @@
static int (*
dyn_fetcher(struct Process *proc))(struct Process *,
- target_address_t *, Elf64_Dyn *)
+ arch_addr_t *, Elf64_Dyn *)
{
return select_32_64(proc, fetch_dyn32, fetch_dyn64);
}
static int
-find_dynamic_entry_addr(struct Process *proc, target_address_t src_addr,
- int d_tag, target_address_t *ret)
+find_dynamic_entry_addr(struct Process *proc, arch_addr_t src_addr,
+ int d_tag, arch_addr_t *ret)
{
debug(DEBUG_FUNCTION, "find_dynamic_entry()");
@@ -340,8 +340,8 @@
if (entry.d_tag == d_tag) {
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- *ret = (target_address_t)(uintptr_t)entry.d_un.d_val;
+ * arch_addr_t becomes integral type. */
+ *ret = (arch_addr_t)(uintptr_t)entry.d_un.d_val;
debug(2, "found address: %p in dtag %d", *ret, d_tag);
return 0;
}
@@ -364,7 +364,7 @@
struct lt_link_map_64 LT_LINK_MAP(64);
static int
-fetch_lm64(struct Process *proc, target_address_t addr,
+fetch_lm64(struct Process *proc, arch_addr_t addr,
struct lt_link_map_64 *ret)
{
if (umovebytes(proc, addr, ret, sizeof(*ret)) != sizeof(*ret))
@@ -373,7 +373,7 @@
}
static int
-fetch_lm32(struct Process *proc, target_address_t addr,
+fetch_lm32(struct Process *proc, arch_addr_t addr,
struct lt_link_map_64 *ret)
{
struct lt_link_map_32 lm;
@@ -391,7 +391,7 @@
static int (*
lm_fetcher(struct Process *proc))(struct Process *,
- target_address_t, struct lt_link_map_64 *)
+ arch_addr_t, struct lt_link_map_64 *)
{
return select_32_64(proc, fetch_lm32, fetch_lm64);
}
@@ -410,7 +410,7 @@
struct lt_r_debug_64 LT_R_DEBUG(64);
static int
-fetch_rd64(struct Process *proc, target_address_t addr,
+fetch_rd64(struct Process *proc, arch_addr_t addr,
struct lt_r_debug_64 *ret)
{
if (umovebytes(proc, addr, ret, sizeof(*ret)) != sizeof(*ret))
@@ -419,7 +419,7 @@
}
static int
-fetch_rd32(struct Process *proc, target_address_t addr,
+fetch_rd32(struct Process *proc, arch_addr_t addr,
struct lt_r_debug_64 *ret)
{
struct lt_r_debug_32 rd;
@@ -437,7 +437,7 @@
static int (*
rdebug_fetcher(struct Process *proc))(struct Process *,
- target_address_t, struct lt_r_debug_64 *)
+ arch_addr_t, struct lt_r_debug_64 *)
{
return select_32_64(proc, fetch_rd32, fetch_rd64);
}
@@ -453,8 +453,8 @@
}
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- target_address_t addr = (target_address_t)(uintptr_t)dbg->r_map;
+ * arch_addr_t becomes integral type. */
+ arch_addr_t addr = (arch_addr_t)(uintptr_t)dbg->r_map;
while (addr != 0) {
struct lt_link_map_64 rlm;
@@ -463,10 +463,10 @@
return;
}
- target_address_t key = addr;
+ arch_addr_t key = addr;
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- addr = (target_address_t)(uintptr_t)rlm.l_next;
+ * arch_addr_t becomes integral type. */
+ addr = (arch_addr_t)(uintptr_t)rlm.l_next;
if (rlm.l_name == 0) {
debug(2, "Name of mapped library is NULL");
return;
@@ -474,8 +474,8 @@
char lib_name[BUFSIZ];
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- umovebytes(proc, (target_address_t)(uintptr_t)rlm.l_name,
+ * arch_addr_t becomes integral type. */
+ umovebytes(proc, (arch_addr_t)(uintptr_t)rlm.l_name,
lib_name, sizeof(lib_name));
if (*lib_name == '\0') {
@@ -512,7 +512,7 @@
/* A struct stored at proc->debug. */
struct debug_struct
{
- target_address_t debug_addr;
+ arch_addr_t debug_addr;
int state;
};
@@ -561,7 +561,7 @@
}
int
-linkmap_init(struct Process *proc, target_address_t dyn_addr)
+linkmap_init(struct Process *proc, arch_addr_t dyn_addr)
{
debug(DEBUG_FUNCTION, "linkmap_init()");
@@ -590,8 +590,8 @@
}
/* XXX The double cast should be removed when
- * target_address_t becomes integral type. */
- target_address_t addr = (target_address_t)(uintptr_t)rdbg.r_brk;
+ * arch_addr_t becomes integral type. */
+ arch_addr_t addr = (arch_addr_t)(uintptr_t)rdbg.r_brk;
if (arch_translate_address_dyn(proc, addr, &addr) < 0)
goto fail;
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index cef8e3d..0829bdb 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -782,7 +782,7 @@
* reason for the re-enablement. In that case
* handle it. */
if (event->type == EVENT_BREAKPOINT) {
- target_address_t ip
+ arch_addr_t ip
= get_instruction_pointer(task);
struct breakpoint *other
= address2bpstruct(leader, ip);
diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c
index 64f57f3..8df900e 100644
--- a/sysdeps/linux-gnu/x86/fetch.c
+++ b/sysdeps/linux-gnu/x86/fetch.c
@@ -592,14 +592,14 @@
abort();
}
-static target_address_t
+static arch_addr_t
fetch_stack_pointer(struct fetch_context *context)
{
- target_address_t sp;
+ arch_addr_t sp;
#ifdef __x86_64__
- sp = (target_address_t)context->iregs.rsp;
+ sp = (arch_addr_t)context->iregs.rsp;
#else
- sp = (target_address_t)context->iregs.esp;
+ sp = (arch_addr_t)context->iregs.esp;
#endif
return sp;
}
diff --git a/sysdeps/linux-gnu/x86/regs.c b/sysdeps/linux-gnu/x86/regs.c
index 477abca..ca6470b 100644
--- a/sysdeps/linux-gnu/x86/regs.c
+++ b/sysdeps/linux-gnu/x86/regs.c
@@ -47,12 +47,12 @@
# define XSP (4 * UESP)
#endif
-static target_address_t
-conv_32(target_address_t val)
+static arch_addr_t
+conv_32(arch_addr_t val)
{
- /* XXX Drop the multiple double casts when target_address_t
+ /* XXX Drop the multiple double casts when arch_addr_t
* becomes integral. */
- return (target_address_t)(uintptr_t)(uint32_t)(uintptr_t)val;
+ return (arch_addr_t)(uintptr_t)(uint32_t)(uintptr_t)val;
}
void *
@@ -65,7 +65,7 @@
}
void
-set_instruction_pointer(struct Process *proc, target_address_t addr)
+set_instruction_pointer(struct Process *proc, arch_addr_t addr)
{
if (proc->e_machine == EM_386)
addr = conv_32(addr);
@@ -82,9 +82,9 @@
return NULL;
}
- /* XXX Drop the multiple double casts when target_address_t
+ /* XXX Drop the multiple double casts when arch_addr_t
* becomes integral. */
- target_address_t ret = (target_address_t)(uintptr_t)sp;
+ arch_addr_t ret = (arch_addr_t)(uintptr_t)sp;
if (proc->e_machine == EM_386)
ret = conv_32(ret);
return ret;
@@ -100,9 +100,9 @@
return NULL;
}
- /* XXX Drop the multiple double casts when target_address_t
+ /* XXX Drop the multiple double casts when arch_addr_t
* becomes integral. */
- target_address_t ret = (target_address_t)(uintptr_t)a;
+ arch_addr_t ret = (arch_addr_t)(uintptr_t)a;
if (proc->e_machine == EM_386)
ret = conv_32(ret);
return ret;
diff --git a/sysdeps/sysdep.h b/sysdeps/sysdep.h
index 96b3857..70a4fa7 100644
--- a/sysdeps/sysdep.h
+++ b/sysdeps/sysdep.h
@@ -28,4 +28,13 @@
};
#endif
+#ifndef ARCH_HAVE_ADDRESS_TYPES
+/* We should in general be able to trace 64-bit processes with 32-bit
+ * ltrace. (At least PPC has several PTRACE requests related to
+ * tracing 64-on-32, so presumably it should be possible.) But ltrace
+ * is currently hopelessly infested with using void* for host address.
+ * So keep with it, for now. */
+typedef void *arch_addr_t;
+#endif
+
#endif /* LTRACE_SYSDEP_H */