chiark / gitweb /
fishdescriptor: fix error handling
[chiark-utils.git] / fishdescriptor / py / fishdescriptor / indonor.py
index c538baa846372d67f47db1b55680c7567bea973e..dcd447a39090c9a6d3321b359af1ccf31fae2de7 100644 (file)
@@ -1,6 +1,8 @@
 
 # class for use inside gdb which is debugging the donor process
 
+from __future__ import print_function
+
 import gdb
 import copy
 import os
@@ -260,6 +262,9 @@ class DonorImplementation():
         return input
 
     def eval_loop(di):
+        if not gdb.selected_inferior().was_attached:
+            print('gdb inferior not attached', file=sys.stderr)
+            sys.exit(0)
         while True:
             di._result('!\n')
             cmd = di._protocol_read()