[pypy-commit] pypy reverse-debugger: Fixes

arigo pypy.commits at gmail.com
Sat Jun 11 08:09:51 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r85100:d36453797864
Date: 2016-06-11 14:10 +0200
http://bitbucket.org/pypy/pypy/changeset/d36453797864/

Log:	Fixes

diff --git a/rpython/translator/revdb/rdb-src/revdb.c b/rpython/translator/revdb/rdb-src/revdb.c
--- a/rpython/translator/revdb/rdb-src/revdb.c
+++ b/rpython/translator/revdb/rdb-src/revdb.c
@@ -28,6 +28,7 @@
 rpy_revdb_t rpy_revdb;
 static char rpy_rev_buffer[16384];
 static int rpy_rev_fileno = -1;
+static unsigned char flag_io_disabled;
 
 
 static void setup_record_mode(int argc, char *argv[]);
@@ -147,7 +148,10 @@
            we read it from the record.  In both cases, we cache the
            hash in the object, so that we record/replay only once per
            object. */
-        RPY_REVDB_EMIT(h = ~((Signed)obj);, Signed _e, h);
+        if (flag_io_disabled)
+            h = ~((Signed)obj);
+        else
+            RPY_REVDB_EMIT(h = ~((Signed)obj);, Signed _e, h);
         assert(h != 0);
         obj->h_hash = h;
     }
@@ -208,7 +212,6 @@
 enum { PK_MAIN_PROCESS, PK_FROZEN_PROCESS, PK_DEBUG_PROCESS };
 static unsigned char process_kind = PK_MAIN_PROCESS;
 static unsigned char flag_exit_run_debug_process;
-static unsigned char flag_io_disabled;
 static jmp_buf jmp_buf_cancel_execution;
 static uint64_t latest_fork;
 
@@ -303,7 +306,7 @@
 }
 
 RPY_EXTERN
-char *rpy_reverse_db_fetch(int expected_size)
+char *rpy_reverse_db_fetch(int expected_size, const char *file, int line)
 {
     if (!flag_io_disabled) {
         ssize_t rsize, keep = rpy_revdb.buf_limit - rpy_revdb.buf_p;
@@ -321,7 +324,8 @@
            running some custom code now, and we can't just perform I/O
            or access raw memory---because there is no raw memory! 
         */
-        printf("Attempted to do I/O or access raw memory\n");
+        printf("%s:%d: Attempted to do I/O or access raw memory\n",
+               file, line);
         longjmp(jmp_buf_cancel_execution, 1);
     }
 }
@@ -474,8 +478,9 @@
     }
     if (stop_points != rpy_revdb.stop_point_seen) {
         fprintf(stderr, "Bad number of stop points "
-                "(seen %llu, recorded %llu)\n", rpy_revdb.stop_point_seen,
-                stop_points);
+                "(seen %llu, recorded %llu)\n",
+                (unsigned long long)rpy_revdb.stop_point_seen,
+                (unsigned long long)stop_points);
         exit(1);
     }
     if (rpy_revdb.buf_p != rpy_revdb.buf_limit ||
diff --git a/rpython/translator/revdb/rdb-src/revdb_include.h b/rpython/translator/revdb/rdb-src/revdb_include.h
--- a/rpython/translator/revdb/rdb-src/revdb_include.h
+++ b/rpython/translator/revdb/rdb-src/revdb_include.h
@@ -52,7 +52,8 @@
             char *_src = rpy_revdb.buf_p;                               \
             char *_end1 = _src + sizeof(_e);                            \
             if (_end1 > rpy_revdb.buf_limit) {                          \
-                _src = rpy_reverse_db_fetch(sizeof(_e));                \
+                _src = rpy_reverse_db_fetch(sizeof(_e),                 \
+                                            __FILE__, __LINE__);        \
                 _end1 = _src + sizeof(_e);                              \
             }                                                           \
             rpy_revdb.buf_p = _end1;                                    \
@@ -77,7 +78,8 @@
     r = rpy_reverse_db_identityhash((struct pypy_header0 *)(obj))
 
 RPY_EXTERN void rpy_reverse_db_flush(void);
-RPY_EXTERN char *rpy_reverse_db_fetch(int expected_size);
+RPY_EXTERN char *rpy_reverse_db_fetch(int expected_size,
+                                      const char *file, int line);
 RPY_EXTERN void rpy_reverse_db_break(long stop_point);
 RPY_EXTERN void rpy_reverse_db_send_output(RPyString *output);
 RPY_EXTERN Signed rpy_reverse_db_identityhash(struct pypy_header0 *obj);


More information about the pypy-commit mailing list