From 27a249c7938fe091d77d633129255327c8c6708e Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 17 Jul 2025 14:12:02 -0400 Subject: Disable exception stack traces by default, except for unhandled exceptions during analysis --- docs/guide/troubleshooting.md | 2 +- exceptions.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index c746fbee..392010e2 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -222,7 +222,7 @@ The following environment variables may be helpful when troubleshooting issues: | BN_DISABLE_USER_SETTINGS | Flag (True if exists) | This flag will cause Binary Ninja to ignore any [`settings.json`](https://docs.binary.ninja/guide/settings.html).| | BN_SCREENSHOT | Flag (True if exists) | This flag removes some small UI clutter to enable cleaner screenshots. | | BN_DEBUG_HTTP | Flag (True if exists) | This flag enables additional debug logging of HTTP activity. | -| BN_DEBUG_EXCEPTION_TRACES | Flag (Enabled by default, disabled if set to "0") | This variable includes stack traces when exceptions are handled (MacOS and Linux only). | +| BN_DEBUG_EXCEPTION_TRACES | Flag (Disabled by default, enabled if set to "1") | This variable includes stack traces when exceptions are handled. | | BN_DEBUG_CLANG | Flag (True if exists) | If set, this flag adds additional debugging information to stdout from clang type parsing. | diff --git a/exceptions.cpp b/exceptions.cpp index f4557238..e57b8d09 100644 --- a/exceptions.cpp +++ b/exceptions.cpp @@ -32,8 +32,11 @@ BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(const std::string& if (stackTrace) { m_stackTrace = stackTrace; - m_message += "\n"; - m_message += stackTrace; + if (var) + { + m_message += "\n"; + m_message += stackTrace; + } BNFreeString(stackTrace); } } @@ -94,8 +97,11 @@ BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(std::exception_ptr if (stackTrace) { m_stackTrace = stackTrace; - m_message += "\n"; - m_message += stackTrace; + if (var) + { + m_message += "\n"; + m_message += stackTrace; + } BNFreeString(stackTrace); } } -- cgit v1.3.1