|
From: <sv...@va...> - 2005-05-16 00:17:02
|
Author: njn
Date: 2005-05-16 01:16:56 +0100 (Mon, 16 May 2005)
New Revision: 3732
Modified:
trunk/coregrind/amd64/core_arch.h
trunk/coregrind/arm/core_arch.h
trunk/coregrind/m_stacktrace.c
trunk/coregrind/x86/core_arch.h
Log:
Moved the stack-walking macros into m_stacktrace.
Modified: trunk/coregrind/amd64/core_arch.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/amd64/core_arch.h 2005-05-16 00:04:02 UTC (rev 3731)
+++ trunk/coregrind/amd64/core_arch.h 2005-05-16 00:16:56 UTC (rev 3732)
@@ -56,11 +56,6 @@
#define VGA_CLREQ_ARGS guest_RAX
#define VGA_CLREQ_RET guest_RDX
=20
-// Stack frame layout and linkage
-#define VGA_FIRST_STACK_FRAME(rbp) (rbp)
-#define VGA_STACK_FRAME_RET(rbp) (((UWord*)rbp)[1])
-#define VGA_STACK_FRAME_NEXT(rbp) (((UWord*)rbp)[0])
-
/* ---------------------------------------------------------------------
Architecture-specific part of a ThreadState
------------------------------------------------------------------ */
Modified: trunk/coregrind/arm/core_arch.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/arm/core_arch.h 2005-05-16 00:04:02 UTC (rev 3731)
+++ trunk/coregrind/arm/core_arch.h 2005-05-16 00:16:56 UTC (rev 3732)
@@ -62,12 +62,6 @@
#define VGA_CLREQ_ARGS guest_R0
#define VGA_CLREQ_RET guest_R0
=20
-// Stack frame layout and linkage
-// XXX ToDo: ???
-#define VGA_FIRST_STACK_FRAME(ebp) (ebp)
-#define VGA_STACK_FRAME_RET(ebp) (((UInt*)ebp)[1])
-#define VGA_STACK_FRAME_NEXT(ebp) (((UInt*)ebp)[0])
-
// Get stack pointer and frame pointer
#define VGA_GET_REAL_STACK_PTR(esp) do { \
I_die_here; \
Modified: trunk/coregrind/m_stacktrace.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_stacktrace.c 2005-05-16 00:04:02 UTC (rev 3731)
+++ trunk/coregrind/m_stacktrace.c 2005-05-16 00:16:56 UTC (rev 3732)
@@ -35,6 +35,19 @@
/*--- Exported functions. ---*/
/*------------------------------------------------------------*/
=20
+// Stack frame layout and linkage
+#if defined(VGA_x86)
+# define FIRST_STACK_FRAME(ebp) (ebp)
+# define STACK_FRAME_RET(ebp) (((UWord*)ebp)[1])
+# define STACK_FRAME_NEXT(ebp) (((UWord*)ebp)[0])
+#elif defined(VGA_amd64)
+# define FIRST_STACK_FRAME(rbp) (rbp)
+# define STACK_FRAME_RET(rbp) (((UWord*)rbp)[1])
+# define STACK_FRAME_NEXT(rbp) (((UWord*)rbp)[0])
+#else
+# error Unknown platform
+#endif
+
/* Take a snapshot of the client's stack, putting the up to 'n_ips' IPs=20
into 'ips'. In order to be thread-safe, we pass in the thread's IP
and FP. Returns number of IPs put in 'ips'. */
@@ -82,6 +95,10 @@
user-space threads package work. JRS 20021001 */
} else {
=20
+ // XXX: I think this line is needed for PPC to work, but I'm not
+ // certain, so I'm commenting it out for the moment.
+ //fp =3D FIRST_STACK_FRAME(fp)
+
while (True) {
=20
if (i >=3D n_ips)
@@ -110,10 +127,10 @@
then use this as a fallback. */
if (fp_min <=3D fp && fp <=3D fp_max) {
/* fp looks sane, so use it. */
- ip =3D VGA_STACK_FRAME_RET(fp);
+ ip =3D STACK_FRAME_RET(fp);
sp =3D fp + sizeof(Addr) /*saved %ebp/%rbp*/=20
+ sizeof(Addr) /*ra*/;
- fp =3D VGA_STACK_FRAME_NEXT(fp);
+ fp =3D STACK_FRAME_NEXT(fp);
ips[i++] =3D ip;
if (debug)
VG_(printf)(" ipsF[%d]=3D%08p\n", i-1, ips[i-1]);
Modified: trunk/coregrind/x86/core_arch.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/x86/core_arch.h 2005-05-16 00:04:02 UTC (rev 3731)
+++ trunk/coregrind/x86/core_arch.h 2005-05-16 00:16:56 UTC (rev 3732)
@@ -56,11 +56,6 @@
#define VGA_CLREQ_ARGS guest_EAX
#define VGA_CLREQ_RET guest_EDX
=20
-// Stack frame layout and linkage
-#define VGA_FIRST_STACK_FRAME(ebp) (ebp)
-#define VGA_STACK_FRAME_RET(ebp) (((UInt*)ebp)[1])
-#define VGA_STACK_FRAME_NEXT(ebp) (((UInt*)ebp)[0])
-
//extern const Char VG_(helper_wrapper_before)[]; /* in dispatch.S */
//extern const Char VG_(helper_wrapper_return)[]; /* in dispatch.S */
=20
|