From: Francis Deslauriers Date: Wed, 29 Aug 2018 16:49:59 +0000 (-0400) Subject: Fix: instruction pointer has different names across arch X-Git-Tag: v2.11.0-rc1~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7445d54f4034116e7276c23c414ea019c5466472;p=lttng-modules.git Fix: instruction pointer has different names across arch 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 Signed-off-by: Mathieu Desnoyers --- diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c index 47f3599f..0b399291 100644 --- a/probes/lttng-uprobes.c +++ b/probes/lttng-uprobes.c @@ -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));