Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > b0cbe0f49a5d77255d18d74997a8e96b > files > 3

systemtap-0.9.7-5.el5.src.rpm

From f3b9509ef1d9b0e76a54ce86ae5d841df5f2a8cf Mon Sep 17 00:00:00 2001
From: David Smith <dsmith@redhat.com>
Date: Mon, 27 Apr 2009 15:53:21 -0500
Subject: [PATCH] Fixed itrace on RHEL5 (PR10091).
 PR10091 fix.
 * runtime/itrace.c: Includes ptrace_compatibility.h.
   (usr_itrace_report_quiesce): Corrected return value for original version
   of utrace.
 * runtime/ptrace_compatibility.h: Defines arch_has_single_step() and
   arch_has_block_step() in terms of ARCH_HAS_SINGLE_STEP and
   ARCH_HAS_BLOCK_STEP.

---
 runtime/itrace.c               |    3 +-
 runtime/ptrace_compatibility.h |   50 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletions(-)
 create mode 100644 runtime/ptrace_compatibility.h

diff --git a/runtime/itrace.c b/runtime/itrace.c
index 97ba427..68f8530 100644
--- a/runtime/itrace.c
+++ b/runtime/itrace.c
@@ -18,6 +18,7 @@
 #include <linux/sched.h>
 #include <linux/rcupdate.h>
 #include <linux/utrace.h>
+#include "ptrace_compatibility.h"
 
 /* PR9974: Adapt to struct renaming. */
 #ifdef UTRACE_API_VERSION
@@ -143,7 +144,7 @@ static u32 usr_itrace_report_quiesce(enum utrace_resume_action action,
 	WARN_ON(!ui);
 
 #ifdef UTRACE_ORIG_VERSION
-	return (ui->step_flag); // XXX XXX XXX 
+	return (ui->step_flag | UTRACE_ACTION_NEWSTATE);
 #else
 	return (event == 0 ? ui->step_flag : UTRACE_RESUME);
 #endif
diff --git a/runtime/ptrace_compatibility.h b/runtime/ptrace_compatibility.h
new file mode 100644
index 0000000..939c3b5
--- /dev/null
+++ b/runtime/ptrace_compatibility.h
@@ -0,0 +1,50 @@
+#ifndef _PTRACE_COMPATIBILITY_H_
+#define _PTRACE_COMPATIBILITY_H_
+
+#include <linux/ptrace.h>
+
+/* Older kernel's linux/ptrace.h don't define
+ * arch_has_single_step()/arch_has_block_step(). */
+
+#ifndef arch_has_single_step
+
+#include <linux/tracehook.h>
+
+/**
+ * arch_has_single_step - does this CPU support user-mode single-step?
+ *
+ * If this is defined, then there must be function declarations or
+ * inlines for user_enable_single_step() and user_disable_single_step().
+ * arch_has_single_step() should evaluate to nonzero iff the machine
+ * supports instruction single-step for user mode.
+ * It can be a constant or it can test a CPU feature bit.
+ */
+
+#ifdef ARCH_HAS_SINGLE_STEP
+#define arch_has_single_step()	(ARCH_HAS_SINGLE_STEP)
+#else
+#define arch_has_single_step()	(0)
+#endif	/* ARCH_HAS_SINGLE_STEP */
+
+#endif	/* arch_has_single_step */
+
+#ifndef arch_has_block_step
+/**
+ * arch_has_block_step - does this CPU support user-mode block-step?
+ *
+ * If this is defined, then there must be a function declaration or inline
+ * for user_enable_block_step(), and arch_has_single_step() must be defined
+ * too.  arch_has_block_step() should evaluate to nonzero iff the machine
+ * supports step-until-branch for user mode.  It can be a constant or it
+ * can test a CPU feature bit.
+ */
+
+#ifdef ARCH_HAS_BLOCK_STEP
+#define arch_has_block_step()	(ARCH_HAS_BLOCK_STEP)
+#else
+#define arch_has_block_step()   (0)
+#endif	/* ARCH_HAS_BLOCK_STEP */
+
+#endif	/* arch_has_block_step */
+
+#endif	/* _PTRACE_COMPATIBILITY_H_ */
-- 
1.6.0.6