Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757579Ab1DAOov (ORCPT ); Fri, 1 Apr 2011 10:44:51 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:36641 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757205Ab1DAOot (ORCPT ); Fri, 1 Apr 2011 10:44:49 -0400 From: Srikar Dronamraju To: Peter Zijlstra , Ingo Molnar Cc: Steven Rostedt , Srikar Dronamraju , Linux-mm , Arnaldo Carvalho de Melo , Linus Torvalds , Andi Kleen , Christoph Hellwig , Jonathan Corbet , Thomas Gleixner , Masami Hiramatsu , Oleg Nesterov , LKML , SystemTap , Jim Keniston , Roland McGrath , Ananth N Mavinakayanahalli , Andrew Morton Date: Fri, 01 Apr 2011 20:05:07 +0530 Message-Id: <20110401143507.15455.87968.sendpatchset@localhost6.localdomain6> In-Reply-To: <20110401143223.15455.19844.sendpatchset@localhost6.localdomain6> References: <20110401143223.15455.19844.sendpatchset@localhost6.localdomain6> Subject: [PATCH v3 2.6.39-rc1-tip 13/26] 13: uprobes: get the breakpoint address. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2200 Lines: 59 On a breakpoint hit, return the address where the breakpoint was hit. Signed-off-by: Srikar Dronamraju Signed-off-by: Jim Keniston --- include/linux/uprobes.h | 5 +++++ kernel/uprobes.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 10647be..91b808a 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -157,6 +157,7 @@ extern void uprobe_free_utask(struct task_struct *tsk); struct vm_area_struct; extern int uprobe_mmap(struct vm_area_struct *vma); +extern unsigned long uprobes_get_bkpt_addr(struct pt_regs *regs); extern void uprobe_dup_mmap(struct mm_struct *old_mm, struct mm_struct *mm); extern void uprobes_free_xol_area(struct mm_struct *mm); #else /* CONFIG_UPROBES is not defined */ @@ -179,5 +180,9 @@ static inline int uprobe_mmap(struct vm_area_struct *vma) } static inline void uprobe_free_utask(struct task_struct *tsk) {} static inline void uprobes_free_xol_area(struct mm_struct *mm) {} +static inline unsigned long uprobes_get_bkpt_addr(struct pt_regs *regs) +{ + return 0; +} #endif /* CONFIG_UPROBES */ #endif /* _LINUX_UPROBES_H */ diff --git a/kernel/uprobes.c b/kernel/uprobes.c index 7663d18..dcae6dd 100644 --- a/kernel/uprobes.c +++ b/kernel/uprobes.c @@ -1190,6 +1190,17 @@ static void xol_free_insn_slot(struct task_struct *tsk, unsigned long slot_addr) __func__, slot_addr); } +/** + * uprobes_get_bkpt_addr - compute address of bkpt given post-bkpt regs + * @regs: Reflects the saved state of the task after it has hit a breakpoint + * instruction. + * Return the address of the breakpoint instruction. + */ +unsigned long uprobes_get_bkpt_addr(struct pt_regs *regs) +{ + return instruction_pointer(regs) - UPROBES_BKPT_INSN_SIZE; +} + /* * Called with no locks held. * Called in context of a exiting or a exec-ing thread. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/