From 9103059a4f81085859c56f5508f9d76022041869 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 24 Oct 2017 17:00:50 +0100 Subject: [PATCH] Revert "fishdescriptor: try parse_eval_via_print" This reverts commit 33545a21597767a50443a717b015fc9e3c8dd553. --- fishdescriptor/py/fishdescriptor/indonor.py | 23 ++------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/fishdescriptor/py/fishdescriptor/indonor.py b/fishdescriptor/py/fishdescriptor/indonor.py index f701434..f01f9eb 100644 --- a/fishdescriptor/py/fishdescriptor/indonor.py +++ b/fishdescriptor/py/fishdescriptor/indonor.py @@ -6,7 +6,6 @@ import copy import os import sys import socket -import re def _string_bytearray(s): # gets us bytes in py2 and py3 @@ -57,15 +56,6 @@ def parse_eval(expr): sys.stderr.flush() return x -def parse_eval_via_print(expr): - # works only with things whose value is an int and where expr is simple - sys.stderr.write("## EVAL-VIA-PRINT %s\n" % repr(expr)) - x = gdb.execute('print %s' % expr, to_string=True) - m = re.match('\$\d+ = (\d+)\n$', x) # seriously ! - r = int(m.group(1)) - sys.stderr.write('## => %s\n' % r) - return 4 - class DonorStructLayout(): def __init__(l, typename): x = gdb.lookup_type(typename) @@ -182,22 +172,13 @@ class DonorImplementation(): return 1 def _errno_save(di): - # incomprehensibly, gdb.parse_and_eval('errno') can sometimes - # fail with - # gdb.error: Cannot find thread-local variables on this target - # even though plain gdb `print errno' works. - # OMG. This may be related to: - # https://github.com/cloudburst/libheap/issues/24 - # although I can't find it in the gdb bug db (which is half-broken - # in my browser) - # Anyway: - di._saved_errno = parse_eval_via_print('errno') + di._saved_errno = parse_eval('errno') def _errno_restore(di): to_restore = di._saved_errno di._saved_errno = None if to_restore is not None: - parse_eval_via_print('errno = %d' % to_restore) + parse_eval('errno = %d' % to_restore) def _result(di, output): sys.stderr.write("#> %s" % output) -- 2.30.2