Index: tests/pybin/settings.py
===================================================================
--- tests/pybin/settings.py	(revision bbdb0c643e5e1d39beac9cc933345506b44d7ff5)
+++ tests/pybin/settings.py	(revision d65818318d7231329b68e5c6644b65c248b52a57)
@@ -123,4 +123,5 @@
 	global output_width
 	global timeout
+	global timeout2gdb
 
 	arch         = Architecture(options.arch)
@@ -134,4 +135,5 @@
 	output_width = 24
 	timeout      = Timeouts(options.timeout, options.global_timeout)
+	timeout2gdb  = options.timeout_with_gdb
 
 	# if we distribute, distcc errors will fail tests, use log file for distcc
Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision bbdb0c643e5e1d39beac9cc933345506b44d7ff5)
+++ tests/pybin/tools.py	(revision d65818318d7231329b68e5c6644b65c248b52a57)
@@ -75,7 +75,12 @@
 					return proc.returncode, out.decode("utf-8") if out else None
 				except subprocess.TimeoutExpired:
-					proc.send_signal(signal.SIGABRT)
-					proc.communicate()
-					return 124, str(None)
+					if settings.timeout2gdb:
+						print("Process {} timeout".format(proc.pid))
+						proc.communicate()
+						return 124, str(None)
+					else:
+						proc.send_signal(signal.SIGABRT)
+						proc.communicate()
+						return 124, str(None)
 
 	except Exception as ex:
Index: tests/test.py
===================================================================
--- tests/test.py	(revision bbdb0c643e5e1d39beac9cc933345506b44d7ff5)
+++ tests/test.py	(revision d65818318d7231329b68e5c6644b65c248b52a57)
@@ -91,4 +91,5 @@
 	parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60)
 	parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
+	parser.add_argument('--timeout-with-gdb', help='Instead of killing the command when it times out, orphan it and print process id to allow gdb to attach', type=yes_no, default="no")
 	parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
 	parser.add_argument('--list', help='List all test available', action='store_true')
@@ -192,4 +193,6 @@
 	rm(exe_file)
 
+	print("HERE")
+
 	return retcode, error, [comp_dur.duration, run_dur.duration if run_dur else None]
 
