and adjust btrace(8) accordingly.
extracted from a larger diff by Tom Rollet.
ok mpi@
-/* $OpenBSD: dt_prov_static.c,v 1.8 2021/06/07 13:55:54 dv Exp $ */
+/* $OpenBSD: dt_prov_static.c,v 1.9 2021/09/02 17:21:39 jasper Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
if (dtev == NULL)
continue;
- dtev->dtev_sysargs[0] = args[0];
- dtev->dtev_sysargs[1] = args[1];
- dtev->dtev_sysargs[2] = args[2];
- dtev->dtev_sysargs[3] = args[3];
- dtev->dtev_sysargs[4] = args[4];
+ dtev->dtev_args[0] = args[0];
+ dtev->dtev_args[1] = args[1];
+ dtev->dtev_args[2] = args[2];
+ dtev->dtev_args[3] = args[3];
+ dtev->dtev_args[4] = args[4];
dt_pcb_ring_consume(dp, dtev);
}
-/* $OpenBSD: dt_prov_syscall.c,v 1.4 2020/07/04 10:19:09 mpi Exp $ */
+/* $OpenBSD: dt_prov_syscall.c,v 1.5 2021/09/02 17:21:39 jasper Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
args = va_arg(ap, register_t*);
va_end(ap);
- KASSERT((argsize / sizeof(register_t)) <= DTMAXSYSARGS);
+ KASSERT((argsize / sizeof(register_t)) <= DTMAXFUNCARGS);
if (sysnum < 0 || sysnum >= dtps_nsysent)
return;
continue;
if (ISSET(dp->dp_evtflags, DTEVT_FUNCARGS))
- memcpy(dtev->dtev_sysargs, args, argsize);
+ memcpy(dtev->dtev_args, args, argsize);
dt_pcb_ring_consume(dp, dtev);
}
continue;
if (error) {
- dtev->dtev_sysretval[0] = -1;
- dtev->dtev_sysretval[1] = 0;
- dtev->dtev_syserror = error;
+ dtev->dtev_retval[0] = -1;
+ dtev->dtev_retval[1] = 0;
+ dtev->dtev_error = error;
} else {
- dtev->dtev_sysretval[0] = retval[0];
- dtev->dtev_sysretval[1] = retval[1];
- dtev->dtev_syserror = 0;
+ dtev->dtev_retval[0] = retval[0];
+ dtev->dtev_retval[1] = retval[1];
+ dtev->dtev_error = 0;
}
dt_pcb_ring_consume(dp, dtev);
-/* $OpenBSD: dtvar.h,v 1.5 2020/07/04 10:19:09 mpi Exp $ */
+/* $OpenBSD: dtvar.h,v 1.6 2021/09/02 17:21:39 jasper Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
#define DTMAXCOMLEN 16
/*
- * Maximum number of arguments passed to a syscall.
+ * Maximum number of arguments passed to a function.
*/
-#define DTMAXSYSARGS 10
+#define DTMAXFUNCARGS 10
/*
* Event state: where to store information when a probe fires.
struct stacktrace dtev_kstack; /* kernel stack frame */
char dtev_comm[DTMAXCOMLEN+1]; /* current pr. name */
union {
- register_t E_entry[DTMAXSYSARGS];
+ register_t E_entry[DTMAXFUNCARGS];
struct {
register_t __retval[2];
int __error;
} E_return;
} _sys;
-#define dtev_sysargs _sys.E_entry /* syscall args. */
-#define dtev_sysretval _sys.E_return.__retval /* syscall retval */
-#define dtev_syserror _sys.E_return.__error /* syscall error */
+#define dtev_args _sys.E_entry /* function args. */
+#define dtev_retval _sys.E_return.__retval /* function retval */
+#define dtev_error _sys.E_return.__error /* function error */
};
-/* $OpenBSD: btrace.c,v 1.45 2021/09/01 13:21:24 mpi Exp $ */
+/* $OpenBSD: btrace.c,v 1.46 2021/09/02 17:21:39 jasper Exp $ */
/*
* Copyright (c) 2019 - 2021 Martin Pieuchot <mpi@openbsd.org>
static char buf[sizeof("18446744073709551615")]; /* UINT64_MAX */
snprintf(buf, sizeof(buf), "%lu",
- dtev->dtev_sysargs[dat - B_AT_BI_ARG0]);
+ dtev->dtev_args[dat - B_AT_BI_ARG0]);
return buf;
}
xabort("store not implemented for type %d", ba->ba_type);
}
- debug("bv=%p var '%s' store (%p) \n", bv, bv_name(bv), bv->bv_value);
+ debug("bv=%p var '%s' store (%p)\n", bv, bv_name(bv), bv->bv_value);
}
/*
val = builtin_nsecs(dtev);
break;
case B_AT_BI_ARG0 ... B_AT_BI_ARG9:
- val = dtev->dtev_sysargs[ba->ba_type - B_AT_BI_ARG0];
+ val = dtev->dtev_args[ba->ba_type - B_AT_BI_ARG0];
break;
case B_AT_BI_RETVAL:
- val = dtev->dtev_sysretval[0];
+ val = dtev->dtev_retval[0];
break;
case B_AT_OP_PLUS ... B_AT_OP_LOR:
val = baexpr2long(ba, dtev);
str = builtin_arg(dtev, ba->ba_type);
break;
case B_AT_BI_RETVAL:
- snprintf(buf, sizeof(buf), "%ld", (long)dtev->dtev_sysretval[0]);
+ snprintf(buf, sizeof(buf), "%ld", (long)dtev->dtev_retval[0]);
str = buf;
break;
case B_AT_MAP: