rpms/stapitrace/devel stapitrace-utrace2.patch, NONE, 1.1 stapitrace.spec, 1.18, 1.19

Dave Nomura dcnomura at fedoraproject.org
Thu Oct 23 17:44:12 UTC 2008


Author: dcnomura

Update of /cvs/pkgs/rpms/stapitrace/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25979

Modified Files:
	stapitrace.spec 
Added Files:
	stapitrace-utrace2.patch 
Log Message:
patch to upgrade to utrace2 API


stapitrace-utrace2.patch:

--- NEW FILE stapitrace-utrace2.patch ---
diff -paurN old/src/stap/usr_itrace.stp new/src/stap/usr_itrace.stp
--- old/src/stap/usr_itrace.stp	2008-08-03 05:36:42.000000000 -0500
+++ new/src/stap/usr_itrace.stp	2008-08-03 05:37:58.000000000 -0500
@@ -19,7 +19,6 @@
 #include <linux/rcupdate.h>
 #include <linux/utrace.h>
 #include <asm/string.h>
-#include <asm/tracehook.h>
 #include <asm/ptrace.h>
 #include "uprobes/uprobes.h"
 #include "usr_itrace.h"
@@ -63,10 +62,25 @@ static void remove_atomic_ss_breakpoint 
 	struct bpt_info *bpt);
 #endif
 
-static u32 usr_itrace_report_signal(struct utrace_attached_engine *engine,
+static u32 usr_itrace_report_quiesce(enum utrace_resume_action action,
+				struct utrace_attached_engine *engine,
+				struct task_struct *tsk,
+				unsigned long event)
+{
+	int status;
+	struct itrace_info *ui;
+
+	ui = rcu_dereference(engine->data);
+	WARN_ON(!ui);
+
+	return (event == 0 ? step_flag : UTRACE_RESUME);
+}
+
+static u32 usr_itrace_report_signal(u32 action,
+			     struct utrace_attached_engine *engine,
 			     struct task_struct *tsk,
 			     struct pt_regs *regs,
-			     u32 action, siginfo_t *info,
+			     siginfo_t *info,
 			     const struct k_sigaction *orig_ka,
 			     struct k_sigaction *return_ka)
 {
@@ -77,16 +91,15 @@ static u32 usr_itrace_report_signal(stru
 	WARN_ON(!ui);
 	
 	if (info->si_signo != SIGTRAP || !ui)
-		return UTRACE_ACTION_RESUME;
+		return UTRACE_RESUME;
 
-	/* normal case: continue stepping, hide this trap from other engines */
-	return_flags =  step_flag | UTRACE_ACTION_HIDE | UTRACE_SIGNAL_IGN |
-			   UTRACE_ACTION_NEWSTATE;
+	/* normal case: continue stepping */
+	return_flags =  step_flag | UTRACE_SIGNAL_IGN;
 
 	if (!ui->itrace_on) {
 		if (debug)
 			printk(KERN_INFO "usr_itrace_off: stop tracing tid %d\n", ui->tid);
-		return_flags = UTRACE_ACTION_NEWSTATE | UTRACE_SIGNAL_IGN;
+		return_flags = UTRACE_RESUME | UTRACE_SIGNAL_IGN;
 	}
 	
 #ifdef CONFIG_PPC
@@ -99,16 +112,15 @@ static u32 usr_itrace_report_signal(stru
 	}
 	
 	if (handle_ppc_atomic_seq(tsk, regs, &ui->ppc_atomic_ss))
-		return_flags = UTRACE_ACTION_RESUME | UTRACE_ACTION_NEWSTATE |
-			UTRACE_SIGNAL_IGN;
+		return_flags = UTRACE_RESUME | UTRACE_SIGNAL_IGN;
 #endif
 
 	usr_itrace_handler(tsk, regs);
-
 	return return_flags;
 }
 
-static u32 usr_itrace_report_clone(struct utrace_attached_engine *engine,
+static u32 usr_itrace_report_clone(enum utrace_resume_action action,
+		struct utrace_attached_engine *engine,
 		struct task_struct *parent, unsigned long clone_flags,
 		struct task_struct *child)
 {
@@ -128,20 +140,21 @@ static u32 usr_itrace_report_clone(struc
 	spin_lock(&itrace_lock);
 	child_ui->itrace_on = parent_ui->itrace_on;
 	spin_unlock(&itrace_lock);
-	return UTRACE_ACTION_RESUME;
+	return UTRACE_RESUME;
 }
 
 static u32 usr_itrace_report_death(struct utrace_attached_engine *e,
-	struct task_struct *tsk)
+	struct task_struct *tsk, bool group_dead, int signal)
 {
 	struct itrace_info *ui = rcu_dereference(e->data);
 	WARN_ON(!ui);
 
-	return (UTRACE_ACTION_NEWSTATE | UTRACE_ACTION_DETACH);
+	return UTRACE_DETACH;
 }
 
 static const struct utrace_engine_ops utrace_ops =
 {
+	.report_quiesce = usr_itrace_report_quiesce,
 	.report_signal = usr_itrace_report_signal,
 	.report_clone = usr_itrace_report_clone,
 	.report_death = usr_itrace_report_death
@@ -191,13 +204,17 @@ static struct itrace_info *create_itrace
 	if (IS_ERR(ui->engine)) {
 		printk(KERN_ERR "utrace_attach returns %ld\n",
 			PTR_ERR(ui->engine));
-		ui = NULL;
-	} else {
-		utrace_set_flags(tsk, ui->engine, ui->engine->flags | step_flag |
-			UTRACE_EVENT(CLONE) | UTRACE_EVENT_SIGNAL_ALL |
-			UTRACE_EVENT(DEATH));
+		return NULL;
 	}
 
+	utrace_set_events(tsk, ui->engine, ui->engine->flags | 
+		UTRACE_EVENT(QUIESCE) |
+		UTRACE_EVENT(CLONE) | UTRACE_EVENT_SIGNAL_ALL |
+		UTRACE_EVENT(DEATH));
+
+	if (utrace_control(tsk, ui->engine, UTRACE_STOP)) 
+		utrace_control(tsk, ui->engine, step_flag); 
+
 	return ui;
 }
 
@@ -227,7 +244,7 @@ void static remove_usr_itrace_info(struc
 
 	spin_lock(&itrace_lock);
 	if (ui->tsk && ui->engine) {
-		(void) utrace_detach(ui->tsk, ui->engine);
+		(void) utrace_control(ui->tsk, ui->engine, UTRACE_DETACH);
 	}
 	list_del(&ui->link);
 	spin_unlock(&itrace_lock);
@@ -269,14 +286,10 @@ function usr_itrace_on:long (tid:long)
 		ui = create_itrace_info(tsk);
 		WARN_ON(!ui);
 		put_task_struct(tsk);
-	} else if (IS_ERR(ui->engine))
-			printk(KERN_ERR "usr_itrace_on: no utrace engine\n");
-	else
-		utrace_set_flags(tsk, ui->engine,
-			ui->engine->flags | step_flag |
-			UTRACE_EVENT(CLONE) |
-			UTRACE_EVENT_SIGNAL_ALL |
-			UTRACE_EVENT(DEATH));
+	} else if (IS_ERR(ui->engine)) {
+		printk(KERN_ERR "usr_itrace_on: no utrace engine\n");
+		return;
+	}
 
 
 	/* start single-stepping engine */
@@ -311,23 +324,21 @@ function usr_itrace_init:long (step_mode
 %{
 	step_flag = 0;
 	if (strncmp(THIS->step_mode, "single_step", 11) == 0) {
-#if defined(ARCH_HAS_SINGLE_STEP) && (ARCH_HAS_SINGLE_STEP != 0)
-		step_flag = UTRACE_ACTION_SINGLESTEP;
-		if (strcmp(THIS->step_mode, "single_step_load_store") == 0) {
-			trace_load_store = 1;
-			if (debug)
-				printk("usr_itrace_init:tracing load/store\n");
-		}
-#else
-		printk("ARCH_HAS_SINGLESTEP not defined in <asm/tracehook.h>\n");
-#endif
+		if (arch_has_single_step()) {
+			step_flag = UTRACE_SINGLESTEP;
+			if (strcmp(THIS->step_mode, "single_step_load_store") == 0) {
+				trace_load_store = 1;
+				if (debug)
+					printk("usr_itrace_init:tracing load/store\n");
+			}
+		} else
+			printk("single_step not supported\n");
 	} else if (strcmp(THIS->step_mode, "block_step") == 0) {
-#if defined( ARCH_HAS_BLOCK_STEP) && (ARCH_HAS_BLOCK_STEP != 0)
-		step_flag = UTRACE_ACTION_BLOCKSTEP;
-		block_step = 1;
-#else
-		printk("ARCH_HAS_BLOCKSTEP not defined in <asm/tracehook.h>\n");
-#endif
+		if (arch_has_block_step()) {
+			step_flag = UTRACE_BLOCKSTEP;
+			block_step = 1;
+		} else
+			printk("block_step not supported\n");
 	} else
 		printk("unknown stepping mode: %s\n", THIS->step_mode);
 


Index: stapitrace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/stapitrace/devel/stapitrace.spec,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- stapitrace.spec	6 Oct 2008 14:22:16 -0000	1.18
+++ stapitrace.spec	23 Oct 2008 17:43:42 -0000	1.19
@@ -6,13 +6,14 @@
 Name:		stapitrace
 Summary:	Instruction Tracing Tool
 Version:	1.0.0
-Release:	18.%{alphatag}%{?dist}
+Release:	19.%{alphatag}%{?dist}
 License:	GPLv2+
 Group:		Development/Tools
 URL:		http://sourceforge.net/projects/perfinsp
 Source0:	%{name}-%{version}.%{alphatag}.tar.gz
 Patch0:		itrace_fix1.patch
 Patch1:		stapitrace-fix-bfd-configure.patch
+Patch2:		stapitrace-utrace2.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root
 Requires:	systemtap systemtap-runtime binutils binutils-devel
 BuildRequires:	binutils binutils-devel autoconf automake zlib-devel
@@ -38,6 +39,7 @@
 %setup -q -n Dpiperf
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 autoreconf -i --force
@@ -85,6 +87,9 @@
 %{_bindir}/itrace
 
 %changelog -n itrace
+* Wed Oct 15 2008 Dave Nomura <dcnltc at us.ibm.com>
+- upgrade to utrace2
+
 * Fri Sep 12 2008 Josh Boyer <jwboyer at gmail.com>
 - Fix bfd configure test as binutils now requires zlib for compressed
   sections




More information about the scm-commits mailing list