Author: Armin Rigo <[email protected]>
Branch: reverse-debugger
Changeset: r85545:1167f883bd80
Date: 2016-07-04 20:00 +0200
http://bitbucket.org/pypy/pypy/changeset/1167f883bd80/

Log:    os._exit() should close the revdb log file

diff --git a/rpython/rlib/debug.py b/rpython/rlib/debug.py
--- a/rpython/rlib/debug.py
+++ b/rpython/rlib/debug.py
@@ -158,7 +158,9 @@
 
 
 def debug_flush():
-    """ Flushes the debug file
+    """ Flushes the debug file.
+
+    With the reverse-debugger, it also closes the output log.
     """
     pass
 
diff --git a/rpython/translator/c/src/debug_print.h 
b/rpython/translator/c/src/debug_print.h
--- a/rpython/translator/c/src/debug_print.h
+++ b/rpython/translator/c/src/debug_print.h
@@ -36,7 +36,13 @@
 #define OP_DEBUG_OFFSET(res)      res = pypy_debug_offset()
 #define OP_DEBUG_FORKED(ofs, _)   pypy_debug_forked(ofs)
 #define OP_HAVE_DEBUG_PRINTS(r)   r = (pypy_have_debug_prints & 1)
-#define OP_DEBUG_FLUSH() fflush(pypy_debug_file)
+
+#ifdef RPY_REVERSE_DEBUGGER
+RPY_EXTERN void rpy_reverse_db_teardown(void);
+#  define OP_DEBUG_FLUSH() fflush(pypy_debug_file); rpy_reverse_db_teardown()
+#else
+#  define OP_DEBUG_FLUSH() fflush(pypy_debug_file)
+#endif
 
 /************************************************************/
 
diff --git a/rpython/translator/revdb/src-revdb/revdb.c 
b/rpython/translator/revdb/src-revdb/revdb.c
--- a/rpython/translator/revdb/src-revdb/revdb.c
+++ b/rpython/translator/revdb/src-revdb/revdb.c
@@ -89,8 +89,13 @@
     RPY_REVDB_EMIT(stop_points = rpy_revdb.stop_point_seen; ,
                    uint64_t _e, stop_points);
 
-    if (!RPY_RDB_REPLAY)
+    if (!RPY_RDB_REPLAY) {
         rpy_reverse_db_flush();
+        if (rpy_rev_fileno >= 0) {
+            close(rpy_rev_fileno);
+            rpy_rev_fileno = -1;
+        }
+    }
     else
         check_at_end(stop_points);
 }
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to