[DTrace-devel] [PATCH] Fix annotation for dt_get_tvar()

Kris Van Hees kris.van.hees at oracle.com
Fri Dec 17 06:16:23 UTC 2021


The disassembler generates the annotation for dt_get_tvar() based on the
wrong instruction.  It looks at the immediate value stored in the
(pc - 2) instruction whereas it should be looking at the one in pc - 3).
The generated sequence for calling dt_get_tvar is:

    (pc - 3)	mov %r1, <val>
    (pc - 2)	mov %r2, <val>
    (pc - 1)	mov %r3, <val>
    (pc)	call dt_get_tvar

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_dis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdtrace/dt_dis.c b/libdtrace/dt_dis.c
index db8989a3..fc479274 100644
--- a/libdtrace/dt_dis.c
+++ b/libdtrace/dt_dis.c
@@ -312,7 +312,7 @@ dt_dis_bpf_args(const dtrace_difo_t *dp, const char *fn,
 		 * the variable id to %r1 (because we wrote the code generator
 		 * to emit these instructions in this exact order.)
 		 */
-		in -= 2;
+		in -= 3;
 		snprintf(buf, len, "self->%s",
 			 dt_dis_varname_id(dp, in->imm + DIF_VAR_OTHER_UBASE,
 					DIFV_SCOPE_THREAD, addr));
-- 
2.34.1




More information about the DTrace-devel mailing list