From 0c5b753211b8052d7758699c1de7d42722cf8d03 Mon Sep 17 00:00:00 2001
From: Julien Duponchelle <julien@duponchelle.info>
Date: Sun, 17 May 2015 12:45:09 +0200
Subject: [PATCH] Add the fault handler in order to try to get a proper crash
 stack

---
 gns3server/crash_report.py | 4 ++++
 gns3server/main.py         | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py
index 23ee7bc0..2cefe0e4 100644
--- a/gns3server/crash_report.py
+++ b/gns3server/crash_report.py
@@ -19,6 +19,10 @@ import os
 import sys
 import struct
 import platform
+import faulthandler
+
+# Display a traceback in case of segfault crash. Usefull when frozen
+faulthandler.enable()
 
 try:
     import raven
diff --git a/gns3server/main.py b/gns3server/main.py
index e0bf9af2..2cdf3653 100644
--- a/gns3server/main.py
+++ b/gns3server/main.py
@@ -190,6 +190,8 @@ def main():
     port = int(server_config["port"])
     server = Server.instance(host, port)
     try:
+        import faulthandler
+        faulthandler._sigsegv()
         server.run()
     except OSError as e:
         # This is to ignore OSError: [WinError 0] The operation completed successfully exception on Windows.