Blob Blame History Raw
diff --git a/sysdeps/linux-gnu/alpha/arch.h b/sysdeps/linux-gnu/alpha/arch.h
index 1107b5f..2dfeec7 100644
--- a/sysdeps/linux-gnu/alpha/arch.h
+++ b/sysdeps/linux-gnu/alpha/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE { 0x80, 0x00, 0x00, 0x00 }
 #define BREAKPOINT_LENGTH 4
 #define DECR_PC_AFTER_BREAK 4
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS     ELFCLASS64
 #define LT_ELF_MACHINE  EM_ALPHA
diff --git a/sysdeps/linux-gnu/arm/arch.h b/sysdeps/linux-gnu/arm/arch.h
index 8f2dfb3..e2a62ab 100644
--- a/sysdeps/linux-gnu/arm/arch.h
+++ b/sysdeps/linux-gnu/arm/arch.h
@@ -6,6 +6,7 @@
 #define THUMB_BREAKPOINT_VALUE { 0x01, 0xde }
 #define THUMB_BREAKPOINT_LENGTH 2
 #define DECR_PC_AFTER_BREAK 0
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_ARM
diff --git a/sysdeps/linux-gnu/i386/arch.h b/sysdeps/linux-gnu/i386/arch.h
index dc7383f..15f0d78 100644
--- a/sysdeps/linux-gnu/i386/arch.h
+++ b/sysdeps/linux-gnu/i386/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE {0xcc}
 #define BREAKPOINT_LENGTH 1
 #define DECR_PC_AFTER_BREAK 1
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_386
diff --git a/sysdeps/linux-gnu/ia64/arch.h b/sysdeps/linux-gnu/ia64/arch.h
index 673047c..d7e0d23 100644
--- a/sysdeps/linux-gnu/ia64/arch.h
+++ b/sysdeps/linux-gnu/ia64/arch.h
@@ -4,6 +4,7 @@
 #define BREAKPOINT_LENGTH 16
 #define BREAKPOINT_VALUE {0}
 #define DECR_PC_AFTER_BREAK 0
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS   ELFCLASS64
 #define LT_ELF_MACHINE EM_IA_64
diff --git a/sysdeps/linux-gnu/m68k/arch.h b/sysdeps/linux-gnu/m68k/arch.h
index 1790d09..44fad89 100644
--- a/sysdeps/linux-gnu/m68k/arch.h
+++ b/sysdeps/linux-gnu/m68k/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE { 0x4e, 0x4f }
 #define BREAKPOINT_LENGTH 2
 #define DECR_PC_AFTER_BREAK 2
+#define ARCH_ENDIAN_BIG
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_68K
diff --git a/sysdeps/linux-gnu/mipsel/arch.h b/sysdeps/linux-gnu/mipsel/arch.h
index dd0ca35..45c4598 100644
--- a/sysdeps/linux-gnu/mipsel/arch.h
+++ b/sysdeps/linux-gnu/mipsel/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE { 0x0d, 0x00, 0x00, 0x00 }
 #define BREAKPOINT_LENGTH 4
 #define DECR_PC_AFTER_BREAK 0
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS	ELFCLASS32
 #define LT_ELF_MACHINE	EM_MIPS
diff --git a/sysdeps/linux-gnu/ppc/arch.h b/sysdeps/linux-gnu/ppc/arch.h
index 711b4a3..8b955e8 100644
--- a/sysdeps/linux-gnu/ppc/arch.h
+++ b/sysdeps/linux-gnu/ppc/arch.h
@@ -14,7 +14,7 @@
 #define PLT_REINITALISATION_BP    "_start"
 
 /* Start of arch-specific functions.  */
-#define ARCH_HAVE_UMOVELONG
+#define ARCH_ENDIAN_BIG
 
 #define PPC_NOP { 0x60, 0x00, 0x00, 0x00 }
 #define PPC_NOP_LENGTH 4
diff -up ltrace-0.6.0/sysdeps/linux-gnu/ppc/trace.c\~ ltrace-0.6.0/sysdeps/linux-gnu/ppc/trace.c
--- ltrace-0.6.0/sysdeps/linux-gnu/ppc/trace.c~	2011-02-14 16:48:25.000000000 +0100
+++ ltrace-0.6.0/sysdeps/linux-gnu/ppc/trace.c	2011-09-03 00:18:14.518317665 +0200
@@ -156,34 +156,3 @@ save_register_args(enum tof type, Proces
 	memcpy(&arch->regs_copy, &arch->regs, sizeof(arch->regs));
 	memcpy(&arch->fpregs_copy, &arch->fpregs, sizeof(arch->fpregs));
 }
-
-/* Read a single long from the process's memory address 'addr'.  */
-int
-arch_umovelong (Process *proc, void *addr, long *result, arg_type_info *info) {
-	long pointed_to;
-
-	errno = 0;
-
-	pointed_to = ptrace (PTRACE_PEEKTEXT, proc->pid, addr, 0);
-
-	if (pointed_to == -1 && errno)
-		return -errno;
-
-	/* Since int's are 4-bytes (long is 8-bytes) in length for ppc64, we
-	   need to shift the long values returned by ptrace to end up with
-	   the correct value.  */
-
-	if (info) {
-		if (info->type == ARGTYPE_INT || (proc->mask_32bit && (info->type == ARGTYPE_POINTER
-		    || info->type == ARGTYPE_STRING))) {
-			pointed_to = pointed_to >> 32;
-
-			/* Make sure we have nothing in the upper word so we can
-			   do a explicit cast from long to int later in the code.  */
-			pointed_to &= 0x00000000ffffffff;
-		}
-	}
-
-	*result = pointed_to;
-	return 0;
-}
diff --git a/sysdeps/linux-gnu/s390/arch.h b/sysdeps/linux-gnu/s390/arch.h
index 5cf168c..c6fed74 100644
--- a/sysdeps/linux-gnu/s390/arch.h
+++ b/sysdeps/linux-gnu/s390/arch.h
@@ -6,6 +6,7 @@
 #define BREAKPOINT_VALUE { 0x00, 0x01 }
 #define BREAKPOINT_LENGTH 2
 #define DECR_PC_AFTER_BREAK 2
+#define ARCH_ENDIAN_BIG
 
 #ifdef __s390x__
 #define LT_ELFCLASS	ELFCLASS64
diff --git a/sysdeps/linux-gnu/sparc/arch.h b/sysdeps/linux-gnu/sparc/arch.h
index 75251b8..bec22ce 100644
--- a/sysdeps/linux-gnu/sparc/arch.h
+++ b/sysdeps/linux-gnu/sparc/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE {0x91, 0xd0, 0x20, 0x01}
 #define BREAKPOINT_LENGTH 4
 #define DECR_PC_AFTER_BREAK 0
+#define ARCH_ENDIAN_BIG
 
 #define LT_ELFCLASS     ELFCLASS32
 #define LT_ELF_MACHINE  EM_SPARC
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index e4be465..9b0b980 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -10,6 +10,7 @@
 #include <assert.h>
 
 #include "common.h"
+#include "config.h"
 
 /* If the system headers did not provide the constants, hard-code the normal
    values.  */
@@ -54,15 +55,23 @@ umovelong (Process *proc, void *addr, long *result, arg_type_info *info) {
 	if (pointed_to == -1 && errno)
 		return -errno;
 
-	*result = pointed_to;
-	if (info) {
-		switch(info->type) {
-			case ARGTYPE_INT:
-				*result &= 0x00000000ffffffffUL;
-			default:
-				break;
-		};
+#if SIZEOF_LONG == 8
+	if (info != NULL
+	    && (info->type == ARGTYPE_INT
+		|| (proc->mask_32bit
+		    && (info->type == ARGTYPE_POINTER
+			|| info->type == ARGTYPE_STRING)))) {
+#if defined (ARCH_ENDIAN_LITTLE)
+		pointed_to &= 0x00000000ffffffffUL;
+#elif defined (ARCH_ENDIAN_BIG)
+		pointed_to = (long)(((unsigned long)pointed_to) >> 32);
+#else
+# error arch.h has to define endianness
+#endif
 	}
+#endif
+
+	*result = pointed_to;
 	return 0;
 }
 #endif
diff --git a/sysdeps/linux-gnu/x86_64/arch.h b/sysdeps/linux-gnu/x86_64/arch.h
index 255395c..34376c4 100644
--- a/sysdeps/linux-gnu/x86_64/arch.h
+++ b/sysdeps/linux-gnu/x86_64/arch.h
@@ -1,6 +1,7 @@
 #define BREAKPOINT_VALUE {0xcc}
 #define BREAKPOINT_LENGTH 1
 #define DECR_PC_AFTER_BREAK 1
+#define ARCH_ENDIAN_LITTLE
 
 #define LT_ELFCLASS	ELFCLASS64
 #define LT_ELF_MACHINE	EM_X86_64