From 3e91fd3115042fba23804e0c17c67b004e44e7ff Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Fri, 15 Sep 2023 17:24:29 +0200 Subject: [PATCH] Correctly compute name for spicyz export with debug log. In 36a6770e9891114b4f42dac3728040c67cc9411e we changed the way Spicy fields exported as record fields are represented. This broke the `zeek` debug log which hardcoded a different representation. This patch brings the generation of the debug log in line with the actual AST structure. We also enable debug logging in one test to validate that it works, at least for the case we hit here. --- src/spicy/spicyz/glue-compiler.cc | 9 +-------- testing/btest/spicy/export-type-with-fields.zeek | 3 ++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/spicy/spicyz/glue-compiler.cc b/src/spicy/spicyz/glue-compiler.cc index 26b35b8303..15dde32516 100644 --- a/src/spicy/spicyz/glue-compiler.cc +++ b/src/spicy/spicyz/glue-compiler.cc @@ -1318,14 +1318,7 @@ struct VisitorZeekType : hilti::visitor::PreOrder() - .ctor() - .as() - .value()[0] - .as() - .ctor() - .as() - .value())); + SPICY_DEBUG(hilti::util::fmt(" %s", f)); } else SPICY_DEBUG(hilti::util::fmt("Creating (empty) Zeek record type %s::%s", ns, local)); diff --git a/testing/btest/spicy/export-type-with-fields.zeek b/testing/btest/spicy/export-type-with-fields.zeek index 30274926c5..381cdbb372 100644 --- a/testing/btest/spicy/export-type-with-fields.zeek +++ b/testing/btest/spicy/export-type-with-fields.zeek @@ -1,6 +1,7 @@ # @TEST-REQUIRES: have-spicy # -# @TEST-EXEC: spicyz -do export.hlto export.spicy export.evt +# Running with `-D zeek` to excercise debug streams. +# @TEST-EXEC: spicyz -D zeek -do export.hlto export.spicy export.evt # @TEST-EXEC: zeek export.hlto %INPUT >>output # @TEST-EXEC: btest-diff output #