Index: tools/gdb/utils-gdb.py
===================================================================
--- tools/gdb/utils-gdb.py	(revision 5669d0bc8498e99c82f19205874296f37e7fe09e)
+++ tools/gdb/utils-gdb.py	(revision e0d6748bb5f7e562816d10ece75a71b7c6288fc5)
@@ -480,17 +480,24 @@
 		context = thread['context']
 
+
+
+		# must be at frame 0 to set pc register
+		gdb.execute('select-frame 0')
+		if gdb.selected_frame().architecture().name() != 'i386:x86-64':
+			print('gdb debugging only supported for i386:x86-64 for now')
+			return
+
+		# gdb seems to handle things much better if we pretend we just entered the context switch
+		# pretend the pc is __cfactx_switch and adjust the sp, base pointer doesn't need to change
 		# lookup for sp,fp and uSwitch
-		xsp = context['SP'] + 48
+		xsp = context['SP'] + 40 # 40 = 5 64bit registers : %r15, %r14, %r13, %r12, %rbx WARNING: x64 specific
 		xfp = context['FP']
 
 		# convert string so we can strip out the address
 		try:
-			xpc = get_addr(gdb.parse_and_eval('__cfactx_switch').address + 28)
+			xpc = get_addr(gdb.parse_and_eval('__cfactx_switch').address)
 		except:
 			print("here")
 			return
-
-		# must be at frame 0 to set pc register
-		gdb.execute('select-frame 0')
 
 		# push sp, fp, pc into a global stack
@@ -503,5 +510,6 @@
 
 		# update registers for new task
-		print('switching to ')
+		# print('switching to {} ({}) : [{}, {}, {}]'.format(thread['self_cor']['name'].string(), str(thread), str(xsp), str(xfp), str(xpc)))
+		print('switching to thread {} ({})'.format(str(thread), thread['self_cor']['name'].string()))
 		gdb.execute('set $rsp={}'.format(xsp))
 		gdb.execute('set $rbp={}'.format(xfp))
@@ -552,5 +560,4 @@
 
 		argv = parse(arg)
-		print(argv)
 		if argv[0].isdigit():
 			cname = " ".join(argv[1:]) if len(argv) > 1 else None
