Author: Armin Rigo <ar...@tunes.org> Branch: reverse-debugger Changeset: r91969:a24d6c7000c8 Date: 2017-07-25 17:58 +0200 http://bitbucket.org/pypy/pypy/changeset/a24d6c7000c8/
Log: Fix for edc44ccff552: the previous fix in clibffi had no effect diff --git a/rpython/memory/gctransform/support.py b/rpython/memory/gctransform/support.py --- a/rpython/memory/gctransform/support.py +++ b/rpython/memory/gctransform/support.py @@ -1,4 +1,5 @@ from rpython.rtyper.lltypesystem import lltype +from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.extregistry import ExtRegistryEntry from rpython.annotator import model as annmodel import os @@ -77,23 +78,19 @@ from rpython.rlib.rposix import c_write return c_write(fd, string, len(string)) -def destructor_failed(typename, e): - try: - write(2, "a destructor of type ") - write(2, typename) - write(2, " raised an exception ") - write(2, str(e)) - write(2, " ignoring it\n") - except: - pass -destructor_failed._dont_inline_ = True - def ll_call_destructor(destrptr, destr_v, typename): + llop.revdb_do_next_call(lltype.Void) try: destrptr(destr_v) except Exception as e: - destructor_failed(typename, e) -ll_call_destructor._revdb_do_all_calls_ = True + try: + write(2, "a destructor of type ") + write(2, typename) + write(2, " raised an exception ") + write(2, str(e)) + write(2, " ignoring it\n") + except: + pass def ll_report_finalizer_error(e): try: diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py --- a/rpython/rlib/clibffi.py +++ b/rpython/rlib/clibffi.py @@ -4,6 +4,7 @@ from rpython.rtyper.tool import rffi_platform from rpython.rtyper.lltypesystem import lltype, rffi +from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.tool import rffi_platform from rpython.rlib.unroll import unrolling_iterable from rpython.rlib.rarithmetic import intmask, is_emulated_long @@ -419,8 +420,8 @@ (what the real callback is for example), casted to VOIDP """ userdata = rffi.cast(USERDATA_P, ll_userdata) + llop.revdb_do_next_call(lltype.Void) userdata.callback(ll_args, ll_res, userdata) -_ll_callback._revdb_do_all_calls_ = True def ll_callback(ffi_cif, ll_res, ll_args, ll_userdata): rposix._errno_after(rffi.RFFI_ERR_ALL | rffi.RFFI_ALT_ERRNO) diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -593,6 +593,7 @@ 'revdb_dtoa': LLOp(sideeffects=False), 'revdb_modf': LLOp(sideeffects=False), 'revdb_frexp': LLOp(sideeffects=False), + 'revdb_do_next_call': LLOp(), } # ***** Run test_lloperation after changes. ***** diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py --- a/rpython/translator/c/funcgen.py +++ b/rpython/translator/c/funcgen.py @@ -713,6 +713,10 @@ return gencsupp.cast_gcptr_to_int(self, op) return self.OP_CAST_POINTER(op) + def OP_REVDB_DO_NEXT_CALL(self, op): + self.revdb_do_next_call = True + return "/* revdb_do_next_call */" + def OP_LENGTH_OF_SIMPLE_GCARRAY_FROM_OPAQUE(self, op): return ('%s = *(long *)(((char *)%s) + sizeof(struct pypy_header0));' ' /* length_of_simple_gcarray_from_opaque */' diff --git a/rpython/translator/revdb/gencsupp.py b/rpython/translator/revdb/gencsupp.py --- a/rpython/translator/revdb/gencsupp.py +++ b/rpython/translator/revdb/gencsupp.py @@ -78,10 +78,11 @@ return 'RPY_REVDB_EMIT(%s, %s, %s);' % (normal_code, cdecl(tp, '_e'), value) def emit_residual_call(funcgen, call_code, v_result, expr_result): - if getattr(getattr(funcgen.graph, 'func', None), - '_revdb_do_all_calls_', False): + if hasattr(funcgen, 'revdb_do_next_call'): + del funcgen.revdb_do_next_call return call_code # a hack for ll_call_destructor() to mean - # that the calls should really be done + # that the calls should really be done. + # Also used in rpython.rlib.clibffi. # if call_code in ('RPyGilAcquire();', 'RPyGilRelease();'): # Could also work with a regular RPY_REVDB_CALL_VOID, but we _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit