Add support for storing builtin TID and PID in variables.
authormpi <mpi@openbsd.org>
Sun, 13 Aug 2023 09:52:47 +0000 (09:52 +0000)
committermpi <mpi@openbsd.org>
Sun, 13 Aug 2023 09:52:47 +0000 (09:52 +0000)
usr.sbin/btrace/btrace.c

index 25333f9..2a114c3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: btrace.c,v 1.71 2023/06/27 14:17:00 claudio Exp $ */
+/*     $OpenBSD: btrace.c,v 1.72 2023/08/13 09:52:47 mpi Exp $ */
 
 /*
  * Copyright (c) 2019 - 2021 Martin Pieuchot <mpi@openbsd.org>
@@ -1028,6 +1028,14 @@ stmt_store(struct bt_stmt *bs, struct dt_evt *dtev)
                bv->bv_value = ba;
                bv->bv_type = B_VT_LONG;
                break;
+       case B_AT_BI_PID:
+               bv->bv_value = ba_new((long)dtev->dtev_pid, B_AT_LONG);
+               bv->bv_type = B_VT_LONG;
+               break;
+       case B_AT_BI_TID:
+               bv->bv_value = ba_new((long)dtev->dtev_tid, B_AT_LONG);
+               bv->bv_type = B_VT_LONG;
+               break;
        case B_AT_BI_NSECS:
                bv->bv_value = ba_new(builtin_nsecs(dtev), B_AT_LONG);
                bv->bv_type = B_VT_LONG;