Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
# fdmap[nominal] = (actual, Donor, there)
def implement_pending():
# fdmap[nominal] = (actual, Donor, there)
def implement_pending():
- actuals = donor.fish([pend[1] for pend in pending])
+ try: actuals = donor.fish([pend[1] for pend in pending])
+ except fishdescriptor.fish.Error as e:
+ print('fishdescriptor error: %s' % e, file=sys.stderr)
+ sys.exit(127)
assert(len(actuals) == len(pending))
for (nominal, there), actual in zip(pending, actuals):
overwriting_info = fdmap.get(nominal)
assert(len(actuals) == len(pending))
for (nominal, there), actual in zip(pending, actuals):
overwriting_info = fdmap.get(nominal)
os.dup2(1,3)
os.dup2(2,1)
os.dup2(1,3)
os.dup2(2,1)
+class Error(Exception): pass
+
class Donor():
def __init__(d, pid, debug=None):
d.pid = pid
class Donor():
def __init__(d, pid, debug=None):
d.pid = pid
def _eval_integer(d, expr):
try:
l = d._sp.stdout.readline()
def _eval_integer(d, expr):
try:
l = d._sp.stdout.readline()
+ if not len(l): raise Error('gdb process donor python repl quit')
if l != b'!\n': raise RuntimeError("indonor said %s" % repr(l))
d._sp.stdin.write(expr.encode('utf-8') + b'\n')
d._sp.stdin.flush()
if l != b'!\n': raise RuntimeError("indonor said %s" % repr(l))
d._sp.stdin.write(expr.encode('utf-8') + b'\n')
d._sp.stdin.flush()
# class for use inside gdb which is debugging the donor process
# class for use inside gdb which is debugging the donor process
+from __future__ import print_function
+
import gdb
import copy
import os
import gdb
import copy
import os
return input
def eval_loop(di):
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()
while True:
di._result('!\n')
cmd = di._protocol_read()