From ef5f6bf505343c0926532f53dc788b26c3640048 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 28 Oct 2024 18:30:17 +0000 Subject: [PATCH] pw_assert_tokenized: Support pw_assert_HandleFailure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibaf22f5b72c4d20260f921910811b5148fceb6bc Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/244793 Commit-Queue: Auto-Submit Reviewed-by: Wyatt Hepler Lint: Lint 🤖 Pigweed-Auto-Submit: Ben Lawson Docs-Not-Needed: Ben Lawson --- pw_assert_tokenized/log_handler.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pw_assert_tokenized/log_handler.cc b/pw_assert_tokenized/log_handler.cc index 3cc2945fd2..c13bbf0ad9 100644 --- a/pw_assert_tokenized/log_handler.cc +++ b/pw_assert_tokenized/log_handler.cc @@ -27,6 +27,18 @@ #include "pw_log_tokenized/metadata.h" #include "pw_span/span.h" +extern "C" void pw_assert_HandleFailure(void) { + PW_HANDLE_LOG(PW_LOG_LEVEL_FATAL, + "pw_assert_tokenized", + PW_LOG_FLAGS, +#if PW_ASSERT_ENABLE_DEBUG + "PW_ASSERT() or PW_DASSERT() failure"); +#else + "PW_ASSERT() failure. Note: PW_DASSERT disabled"); +#endif // PW_ASSERT_ENABLE_DEBUG + PW_UNREACHABLE; +} + extern "C" void pw_assert_tokenized_HandleAssertFailure( uint32_t tokenized_file_name, int line_number) { // Buffer size for binary->base64 conversion with a null terminator.