64 lines
1.5 KiB
Diff
64 lines
1.5 KiB
Diff
|
--- ./src/Standard/Standard_StackTrace.cxx
|
||
|
+++ ./src/Standard/Standard_StackTrace.cxx
|
||
|
@@ -30,7 +30,6 @@
|
||
|
#elif defined(__QNX__)
|
||
|
//#include <backtrace.h> // requires linking to libbacktrace
|
||
|
#elif !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
|
||
|
- #include <execinfo.h>
|
||
|
#elif defined(_WIN32) && !defined(OCCT_UWP)
|
||
|
|
||
|
#include <Standard_WarningsDisable.hxx>
|
||
|
@@ -314,51 +313,6 @@
|
||
|
return false;
|
||
|
#endif
|
||
|
#else
|
||
|
- const int aTopSkip = theNbTopSkip + 1; // skip this function call and specified extra number
|
||
|
- int aNbTraces = theNbTraces + aTopSkip;
|
||
|
- void** aStackArr = (void** )alloca (sizeof(void*) * aNbTraces);
|
||
|
- if (aStackArr == NULL)
|
||
|
- {
|
||
|
- return false;
|
||
|
- }
|
||
|
-
|
||
|
- aNbTraces = ::backtrace (aStackArr, aNbTraces);
|
||
|
- if (aNbTraces <= 1)
|
||
|
- {
|
||
|
- return false;
|
||
|
- }
|
||
|
-
|
||
|
- aNbTraces -= aTopSkip;
|
||
|
- char** aStrings = ::backtrace_symbols (aStackArr + aTopSkip, aNbTraces);
|
||
|
- if (aStrings == NULL)
|
||
|
- {
|
||
|
- return false;
|
||
|
- }
|
||
|
-
|
||
|
- const size_t aLenInit = strlen (theBuffer);
|
||
|
- size_t aLimit = (size_t) theBufferSize - aLenInit - 1;
|
||
|
- if (aLimit > 14)
|
||
|
- {
|
||
|
- strcat (theBuffer, "\n==Backtrace==");
|
||
|
- aLimit -= 14;
|
||
|
- }
|
||
|
- for (int aLineIter = 0; aLineIter < aNbTraces; ++aLineIter)
|
||
|
- {
|
||
|
- const size_t aLen = strlen (aStrings[aLineIter]);
|
||
|
- if (aLen + 1 >= aLimit)
|
||
|
- {
|
||
|
- break;
|
||
|
- }
|
||
|
-
|
||
|
- strcat (theBuffer, "\n");
|
||
|
- strcat (theBuffer, aStrings[aLineIter]);
|
||
|
- aLimit -= aLen + 1;
|
||
|
- }
|
||
|
- free (aStrings);
|
||
|
- if (aLimit > 14)
|
||
|
- {
|
||
|
- strcat (theBuffer, "\n=============");
|
||
|
- }
|
||
|
- return true;
|
||
|
+ return false;
|
||
|
#endif
|
||
|
}
|