/*
* user space instruction tracing
* Copyright (C) 2005, 2006, 2007, 2008, 2009 IBM Corp.
+ * Copyright (C) 2009 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
#include <linux/utrace.h>
#include <asm/string.h>
#include "uprobes/uprobes.h"
+#include "utrace_compatibility.h"
#ifndef put_task_struct
#define put_task_struct(t) \
struct list_head link;
};
-static u32 debug = 1;
+static u32 debug = 0 /* 1 */;
static LIST_HEAD(usr_itrace_info);
static spinlock_t itrace_lock;
return buf - old_buf;
}
+#ifdef UTRACE_ORIG_VERSION
+static u32 usr_itrace_report_quiesce(struct utrace_attached_engine *engine,
+ struct task_struct *tsk)
+#else
static u32 usr_itrace_report_quiesce(enum utrace_resume_action action,
struct utrace_attached_engine *engine,
struct task_struct *tsk,
unsigned long event)
+#endif
{
int status;
struct itrace_info *ui;
ui = rcu_dereference(engine->data);
WARN_ON(!ui);
+#ifdef UTRACE_ORIG_VERSION
+ return (ui->step_flag); // XXX XXX XXX
+#else
return (event == 0 ? ui->step_flag : UTRACE_RESUME);
+#endif
}
+#ifdef UTRACE_ORIG_VERSION
+static u32 usr_itrace_report_signal(
+ struct utrace_attached_engine *engine,
+ struct task_struct *tsk,
+ struct pt_regs *regs,
+ u32 action, siginfo_t *info,
+ const struct k_sigaction *orig_ka,
+ struct k_sigaction *return_ka)
+#else
static u32 usr_itrace_report_signal(u32 action,
struct utrace_attached_engine *engine,
struct task_struct *tsk,
siginfo_t *info,
const struct k_sigaction *orig_ka,
struct k_sigaction *return_ka)
+#endif
{
struct itrace_info *ui;
u32 return_flags;
return return_flags;
}
+
+
+#ifdef UTRACE_ORIG_VERSION
+static u32 usr_itrace_report_clone(
+ struct utrace_attached_engine *engine,
+ struct task_struct *parent,
+ unsigned long clone_flags,
+ struct task_struct *child)
+#else
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)
+#endif
{
return UTRACE_RESUME;
}
+#ifdef UTRACE_ORIG_VERSION
+static u32 usr_itrace_report_death(struct utrace_attached_engine *e,
+ struct task_struct *tsk)
+#else
static u32 usr_itrace_report_death(struct utrace_attached_engine *e,
struct task_struct *tsk, bool group_dead, int signal)
+#endif
{
struct itrace_info *ui = rcu_dereference(e->data);
WARN_ON(!ui);
spin_lock_init(&itrace_lock);
rcu_read_lock();
+#ifdef STAPCONF_FIND_TASK_PID
+ tsk = find_task_by_pid(tid);
+#else
tsk = find_task_by_vpid(tid);
+#endif
if (!tsk) {
printk(KERN_ERR "usr_itrace_init: Cannot find process %d\n", tid);
rcu_read_unlock();
/*
* utrace compatibility defines and inlines
- * Copyright (C) 2008 Red Hat Inc.
+ * Copyright (C) 2008-2009 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
UTRACE_STOP = UTRACE_ACTION_QUIESCE,
UTRACE_RESUME = UTRACE_ACTION_RESUME,
UTRACE_DETACH = UTRACE_ACTION_DETACH,
+ UTRACE_SINGLESTEP = UTRACE_ACTION_SINGLESTEP,
+ UTRACE_BLOCKSTEP = UTRACE_ACTION_BLOCKSTEP,
};
static inline struct utrace_attached_engine *
case UTRACE_STOP:
return utrace_set_flags(target, engine,
(engine->flags | UTRACE_ACTION_QUIESCE));
+ case UTRACE_SINGLESTEP:
+ case UTRACE_BLOCKSTEP:
+ return utrace_set_flags(target, engine,
+ engine->flags | action);
+
default:
return -EINVAL;
}