From 42cd3088a05e094e26335b38954f92368a3ed626 Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 1 Sep 2021 08:01:09 +0000 Subject: [PATCH] Always print non-empty map & hist on exit even if there's an END rule. Match bpftrace behavior. --- usr.sbin/btrace/btrace.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c index 6c220940999..3fed1ee26e4 100644 --- a/usr.sbin/btrace/btrace.c +++ b/usr.sbin/btrace/btrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.c,v 1.43 2021/09/01 07:35:21 mpi Exp $ */ +/* $OpenBSD: btrace.c,v 1.44 2021/09/01 08:01:09 mpi Exp $ */ /* * Copyright (c) 2019 - 2021 Martin Pieuchot @@ -522,12 +522,10 @@ rules_teardown(int fd) if (rend) rule_eval(rend, &bt_devt); - else { - debug("eval default 'end' rule\n"); - TAILQ_FOREACH(r, &g_rules, br_next) - rule_printmaps(r); - } + /* Print non-empty map & hist */ + TAILQ_FOREACH(r, &g_rules, br_next) + rule_printmaps(r); } void -- 2.20.1