| 23 | #include <stdlib.h> |
| 24 | |
| 25 | BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(const std::string& message) |
| 26 | { |
| 27 | m_originalMessage = message; |
| 28 | m_message = message; |
| 29 | if (auto var = getenv("BN_DEBUG_EXCEPTION_TRACES"); !var || var[0] != '0') |
| 30 | { |
| 31 | char* stackTrace = BNGetCurrentStackTraceString(); |
| 32 | if (stackTrace) |
| 33 | { |
| 34 | m_stackTrace = stackTrace; |
| 35 | m_message += "\n"; |
| 36 | m_message += stackTrace; |
| 37 | BNFreeString(stackTrace); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | |
| 43 | BinaryNinja::ExceptionWithStackTrace::ExceptionWithStackTrace(std::exception_ptr exc1, std::exception_ptr exc2) |