summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/btrace/btrace.c8
-rw-r--r--usr.sbin/btrace/map.c3
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c
index 64acf9eaef6..3eda0a638fd 100644
--- a/usr.sbin/btrace/btrace.c
+++ b/usr.sbin/btrace/btrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.c,v 1.26 2020/12/07 18:28:09 bluhm Exp $ */
+/* $OpenBSD: btrace.c,v 1.27 2021/01/21 13:19:25 mpi Exp $ */
/*
* Copyright (c) 2019 - 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -1030,6 +1030,7 @@ baexpr2long(struct bt_arg *ba, struct dt_evt *dtev)
long
ba2long(struct bt_arg *ba, struct dt_evt *dtev)
{
+ struct bt_var *bv;
long val;
switch (ba->ba_type) {
@@ -1040,6 +1041,11 @@ ba2long(struct bt_arg *ba, struct dt_evt *dtev)
ba = ba_read(ba);
val = (long)ba->ba_value;
break;
+ case B_AT_MAP:
+ bv = ba->ba_value;
+ val = ba2long(map_get((struct map *)bv->bv_value,
+ ba2str(ba->ba_key, dtev)), dtev);
+ break;
case B_AT_BI_NSECS:
val = builtin_nsecs(dtev);
break;
diff --git a/usr.sbin/btrace/map.c b/usr.sbin/btrace/map.c
index f50f9abdca7..85e675d94f4 100644
--- a/usr.sbin/btrace/map.c
+++ b/usr.sbin/btrace/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.11 2020/09/18 19:19:38 jasper Exp $ */
+/* $OpenBSD: map.c,v 1.12 2021/01/21 13:19:25 mpi Exp $ */
/*
* Copyright (c) 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -138,6 +138,7 @@ map_insert(struct map *map, const char *key, struct bt_arg *bval,
free(mep->mval);
mep->mval = bval;
break;
+ case B_AT_BI_NSECS:
case B_AT_BI_RETVAL:
free(mep->mval);
mep->mval = ba_new(ba2long(bval, dtev), B_AT_LONG);