Skip to contentSkip to conversation

ptrace: introduce user_single_step_siginfo() helper

PATCH In review Oleg Nesterov 1 participant 1 message Nov 12, 2009

Subsystems (2)
lore
Share & tools
lore

Oleg Nesterov

author maintainer
#0 lore raw

PATCH v2 1/5 ptrace: introduce user_single_step_siginfo() helper

Suggested by Roland.

Currently there is no way to synthesize a single-stepping trap in the arch-independent manner. This patch adds the default helper which fills siginfo_t, arch/ can can override it.

---

 include/linux/ptrace.h |   12 ++++++++++++
 1 file changed, 12 insertions(+)
include/linux/ptrace.h renamed from include/linux/ptrace.h~1_DEFAULT_HELPER +12 -0
@@ -273,6 +273,18 @@ static inline void user_enable_block_ste
 }
 #endif	/* arch_has_block_step */
 
+#ifdef ARCH_HAS_USER_SINGLE_STEP_INFO
+extern void user_single_step_siginfo(struct task_struct *tsk,
+				struct pt_regs *regs, siginfo_t *info);
+#else
+static inline void user_single_step_siginfo(struct task_struct *tsk,
+				struct pt_regs *regs, siginfo_t *info)
+{
+	memset(info, 0, sizeof(*info));
+	info->si_signo = SIGTRAP;
+}
+#endif
+
 #ifndef arch_ptrace_stop_needed
 /**
  * arch_ptrace_stop_needed - Decide whether arch_ptrace_stop() should be called