aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-27 17:01:22 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-27 17:01:22 +0100
commit1c9e0d95263480a5ae5d645cabb41f835d1dbb70 (patch)
tree25f46dc18d8f8430d46ad365452ce0d8a7c9d9d0 /sources/shiboken2/libshiboken
parentad14f64972d182fca3e180c08750ca020a91b84e (diff)
parent2490c34325bb1b39922582090a4cb69c01726999 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.9
Diffstat (limited to 'sources/shiboken2/libshiboken')
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp
index e6d64c16e..a2cd12a87 100644
--- a/sources/shiboken2/libshiboken/signature.cpp
+++ b/sources/shiboken2/libshiboken/signature.cpp
@@ -442,6 +442,32 @@ static PyGetSetDef new_PyType_getsets[] = {
// This special Type_Ready does certain initializations earlier with
// our new version.
//
+
+#ifndef _WIN32
+////////////////////////////////////////////////////////////////////////////
+// a stack trace for linux-like platforms
+#include <stdio.h>
+#include <execinfo.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void handler(int sig) {
+ void *array[30];
+ size_t size;
+
+ // get void*'s for all entries on the stack
+ size = backtrace(array, 30);
+
+ // print out all the frames to stderr
+ fprintf(stderr, "Error: signal %d:\n", sig);
+ backtrace_symbols_fd(array, size, STDERR_FILENO);
+ exit(1);
+}
+
+////////////////////////////////////////////////////////////////////////////
+#endif // _WIN32
+
static int
PySideType_Ready(PyTypeObject *type)
{
@@ -461,6 +487,12 @@ PySideType_Ready(PyTypeObject *type)
|| add_more_getsets(&PyStaticMethod_Type, new_PyStaticMethod_getsets) < 0
|| add_more_getsets(&PyType_Type, new_PyType_getsets) < 0)
return -1;
+#ifndef _WIN32
+ // we enable the stack trace in CI, only.
+ const char *testEnv = getenv("QTEST_ENVIRONMENT");
+ if (testEnv && strstr(testEnv, "ci"))
+ signal(SIGSEGV, handler); // install our handler
+#endif // _WIN32
init_done = 1;
}
return PyType_Ready(type);