]> sourceware.org Git - systemtap.git/commitdiff
start of rhel5 compatibility for itrace
authorFrank Ch. Eigler <fche@elastic.org>
Thu, 19 Mar 2009 15:28:04 +0000 (11:28 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Thu, 19 Mar 2009 16:17:48 +0000 (12:17 -0400)
runtime/itrace.c
runtime/utrace_compatibility.h

index da874f63b4d2ca921ea2091512df5daee7470fb4..3d9ded2f5a017e4be2a423164581d0428bbbce0b 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * 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
@@ -19,6 +20,7 @@
 #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)     \
@@ -55,7 +57,7 @@ struct itrace_info {
        struct list_head link;
 };
 
-static u32 debug = 1;
+static u32 debug = 0 /* 1 */;
 
 static LIST_HEAD(usr_itrace_info);
 static spinlock_t itrace_lock;
@@ -118,10 +120,15 @@ static int __access_process_vm(struct task_struct *tsk, unsigned long addr, void
        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;
@@ -129,10 +136,23 @@ static u32 usr_itrace_report_quiesce(enum utrace_resume_action action,
        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,
@@ -140,6 +160,7 @@ static u32 usr_itrace_report_signal(u32 action,
                             siginfo_t *info,
                             const struct k_sigaction *orig_ka,
                             struct k_sigaction *return_ka)
+#endif
 {
        struct itrace_info *ui;
        u32 return_flags;
@@ -174,16 +195,31 @@ static u32 usr_itrace_report_signal(u32 action,
        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);
@@ -277,7 +313,11 @@ static int usr_itrace_init(int single_step, pid_t tid, struct stap_itrace_probe
 
        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();
index 00b841d2115cc04086912587a88ff53719eb1879..4a70da428d6b0ba3e2e208b1e5d13c618d8d44b1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * 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
@@ -28,6 +28,8 @@ enum utrace_resume_action {
        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 *
@@ -48,6 +50,11 @@ utrace_control(struct task_struct *target,
        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;
        }
This page took 0.033146 seconds and 5 git commands to generate.