]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
tracehook: tracehook_signal_handler
authorRoland McGrath <roland@redhat.com>
Sat, 26 Jul 2008 02:45:50 +0000 (19:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 26 Jul 2008 19:00:09 +0000 (12:00 -0700)
This defines tracehook_signal_handler() as a hook for the arch signal
handling code to call.  It gives ptrace the opportunity to stop for a
pseudo-single-step trap immediately after signal handler setup is done.

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/tracehook.h

index e113e09b0341b657c44fe371d359302bb7f56a98..2d1426f8e33b950aae49943cd1680b1056c51d0d 100644 (file)
@@ -289,4 +289,27 @@ static inline void tracehook_finish_release_task(struct task_struct *task)
        ptrace_release_task(task);
 }
 
+/**
+ * tracehook_signal_handler - signal handler setup is complete
+ * @sig:               number of signal being delivered
+ * @info:              siginfo_t of signal being delivered
+ * @ka:                        sigaction setting that chose the handler
+ * @regs:              user register state
+ * @stepping:          nonzero if debugger single-step or block-step in use
+ *
+ * Called by the arch code after a signal handler has been set up.
+ * Register and stack state reflects the user handler about to run.
+ * Signal mask changes have already been made.
+ *
+ * Called without locks, shortly before returning to user mode
+ * (or handling more signals).
+ */
+static inline void tracehook_signal_handler(int sig, siginfo_t *info,
+                                           const struct k_sigaction *ka,
+                                           struct pt_regs *regs, int stepping)
+{
+       if (stepping)
+               ptrace_notify(SIGTRAP);
+}
+
 #endif /* <linux/tracehook.h> */