Fix: instruction pointer has different names across arch
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 29 Aug 2018 16:49:59 +0000 (12:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 30 Aug 2018 00:30:31 +0000 (20:30 -0400)
Different terms are used to refer to the instruction pointer depending
on the CPU architecture.

For example:
x86 -> ip
powerpc -> nip
RISC-V -> sepc
ARM -> ARM_pc
Microblaze -> pc

To fix this issue, we use the instruction_pointer() kernel function
(or macro depending on the arch) to get the right field in the pt_regs
struct for the current architecture.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
probes/lttng-uprobes.c

index 47f3599f2baa336dd6c7e543a81aef5070b67efb..0b399291245f9f38d4ce1f52931311ebada3d73a 100644 (file)
@@ -67,7 +67,7 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
                return 0;
 
        /* Event payload. */
-       payload.ip = regs->ip;
+       payload.ip = (unsigned long)instruction_pointer(regs);
 
        lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload));
        chan->ops->event_write(&ctx, &payload, sizeof(payload));
This page took 0.026906 seconds and 4 git commands to generate.