[PATCH] powerpc/uprobes: teach uprobes to ignore gdb breakpoints

Ananth N Mavinakayanahalli ananth at in.ibm.com
Wed Mar 20 21:40:33 EST 2013

From: Ananth N Mavinakayanahalli <ananth at in.ibm.com>

GDB uses a variant of the trap instruction that is different from the
one used by uprobes. Currently, running gdb on a program being traced
by uprobes causes an endless loop since uprobes doesn't understand
that the trap is inserted by some other entity and hence a SIGTRAP needs
to be delivered.

Teach uprobes to ignore breakpoints that doesn't belong to it.

Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
Cc: stable at vger.kernel.org
 arch/powerpc/kernel/uprobes.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: linux-3.9-rc3/arch/powerpc/kernel/uprobes.c
--- linux-3.9-rc3.orig/arch/powerpc/kernel/uprobes.c
+++ linux-3.9-rc3/arch/powerpc/kernel/uprobes.c
@@ -80,6 +80,16 @@ unsigned long uprobe_get_swbp_addr(struc
 	return instruction_pointer(regs);
+ * is_swbp_insn - check if the instruction is a breakpoint instruction.
+ * @insn: instruction to be checked.
+ * Returns true if @insn is a breakpoint instruction.
+ */
+bool is_swbp_insn(uprobe_opcode_t *insn)
+	return (is_trap(*insn));
  * If xol insn itself traps and generates a signal (SIGILL/SIGSEGV/etc),
  * then detect the case where a singlestepped instruction jumps back to its

More information about the Linuxppc-dev mailing list