Skip to content

Commit 27a249c

Browse files
D0ntPanicplafosse
authored andcommitted
Disable exception stack traces by default, except for unhandled exceptions during analysis
1 parent dab7de5 commit 27a249c

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

docs/guide/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ The following environment variables may be helpful when troubleshooting issues:
222222
| 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).|
223223
| BN_SCREENSHOT | Flag (True if exists) | This flag removes some small UI clutter to enable cleaner screenshots. |
224224
| BN_DEBUG_HTTP | Flag (True if exists) | This flag enables additional debug logging of HTTP activity. |
225-
| 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). |
225+
| BN_DEBUG_EXCEPTION_TRACES | Flag (Disabled by default, enabled if set to "1") | This variable includes stack traces when exceptions are handled. |
226226
| BN_DEBUG_CLANG | Flag (True if exists) | If set, this flag adds additional debugging information to stdout from clang type parsing. |
227227

228228

exceptions.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(const std::string&
3232
if (stackTrace)
3333
{
3434
m_stackTrace = stackTrace;
35-
m_message += "\n";
36-
m_message += stackTrace;
35+
if (var)
36+
{
37+
m_message += "\n";
38+
m_message += stackTrace;
39+
}
3740
BNFreeString(stackTrace);
3841
}
3942
}
@@ -94,8 +97,11 @@ BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(std::exception_ptr
9497
if (stackTrace)
9598
{
9699
m_stackTrace = stackTrace;
97-
m_message += "\n";
98-
m_message += stackTrace;
100+
if (var)
101+
{
102+
m_message += "\n";
103+
m_message += stackTrace;
104+
}
99105
BNFreeString(stackTrace);
100106
}
101107
}

0 commit comments

Comments
 (0)