Message ID | 1382008671-4515-7-git-send-email-sandeepa.prabhu@linaro.org |
---|---|
State | New |
Headers | show |
On Thu, Oct 17, 2013 at 12:17:51PM +0100, Sandeepa Prabhu wrote: > Add info prints in sample kprobe handlers for ARM and ARM64 > architecture. > > Signed-off-by: Sandeepa Prabhu <sandeepa.prabhu@linaro.org> > --- > samples/kprobes/kprobe_example.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c > index 366db1a..0521246 100644 > --- a/samples/kprobes/kprobe_example.c > +++ b/samples/kprobes/kprobe_example.c > @@ -42,6 +42,14 @@ static int handler_pre(struct kprobe *p, struct pt_regs *regs) > " ex1 = 0x%lx\n", > p->addr, regs->pc, regs->ex1); > #endif > +#ifdef CONFIG_ARM > + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", > + p->addr, regs->ARM_pc); > +#endif > +#ifdef CONFIG_ARM64 > + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", > + p->addr, (long)regs->pc); > +#endif Huh? Why can't you combine these two together and either unconditionall cast to long, or use void * and %p? Will
On 25 October 2013 20:54, Will Deacon <will.deacon@arm.com> wrote: > On Thu, Oct 17, 2013 at 12:17:51PM +0100, Sandeepa Prabhu wrote: >> Add info prints in sample kprobe handlers for ARM and ARM64 >> architecture. >> >> Signed-off-by: Sandeepa Prabhu <sandeepa.prabhu@linaro.org> >> --- >> samples/kprobes/kprobe_example.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c >> index 366db1a..0521246 100644 >> --- a/samples/kprobes/kprobe_example.c >> +++ b/samples/kprobes/kprobe_example.c >> @@ -42,6 +42,14 @@ static int handler_pre(struct kprobe *p, struct pt_regs *regs) >> " ex1 = 0x%lx\n", >> p->addr, regs->pc, regs->ex1); >> #endif >> +#ifdef CONFIG_ARM >> + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", >> + p->addr, regs->ARM_pc); >> +#endif >> +#ifdef CONFIG_ARM64 >> + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", >> + p->addr, (long)regs->pc); >> +#endif > > Huh? Why can't you combine these two together and either unconditionall cast > to long, or use void * and %p? pt_regs member names are different: regs->pc (arm64) vs. regs->ARM_pc (arm32). It is still possible to use instruction_pointer(regs) for both architectures, but this needs including asm/ptrace.h which I am not sure good thing to do in samples/ Thanks, Sandeepa > > Will > -- > 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/
diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c index 366db1a..0521246 100644 --- a/samples/kprobes/kprobe_example.c +++ b/samples/kprobes/kprobe_example.c @@ -42,6 +42,14 @@ static int handler_pre(struct kprobe *p, struct pt_regs *regs) " ex1 = 0x%lx\n", p->addr, regs->pc, regs->ex1); #endif +#ifdef CONFIG_ARM + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", + p->addr, regs->ARM_pc); +#endif +#ifdef CONFIG_ARM64 + printk(KERN_INFO "pre_handler: p->addr = 0x%p, pc = 0x%lx\n", + p->addr, (long)regs->pc); +#endif /* A dump_stack() here will give a stack backtrace */ return 0; @@ -67,6 +75,14 @@ static void handler_post(struct kprobe *p, struct pt_regs *regs, printk(KERN_INFO "post_handler: p->addr = 0x%p, ex1 = 0x%lx\n", p->addr, regs->ex1); #endif +#ifdef CONFIG_ARM + printk(KERN_INFO "post_handler: p->addr = 0x%p, pc = 0x%lx\n", + p->addr, regs->ARM_pc); +#endif +#ifdef CONFIG_ARM64 + printk(KERN_INFO "post_handler: p->addr = 0x%p, pc = 0x%lx\n", + p->addr, (long)regs->pc); +#endif } /*
Add info prints in sample kprobe handlers for ARM and ARM64 architecture. Signed-off-by: Sandeepa Prabhu <sandeepa.prabhu@linaro.org> --- samples/kprobes/kprobe_example.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)