Author: Armin Rigo <ar...@tunes.org>
Branch: reverse-debugger
Changeset: r85558:edc44ccff552
Date: 2016-07-05 14:41 +0200
http://bitbucket.org/pypy/pypy/changeset/edc44ccff552/

Log:    Next fix (in clibffi.py), improve the debugging support

diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -420,6 +420,7 @@
     """
     userdata = rffi.cast(USERDATA_P, ll_userdata)
     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/translator/revdb/gencsupp.py 
b/rpython/translator/revdb/gencsupp.py
--- a/rpython/translator/revdb/gencsupp.py
+++ b/rpython/translator/revdb/gencsupp.py
@@ -60,7 +60,8 @@
         name = funcgen.functionname
         funcgen.db.stack_bottom_funcnames.append(name)
         extra_enter_text = '\n'.join(
-            ['RPY_REVDB_CALLBACKLOC(RPY_CALLBACKLOC_%s);' % name] +
+            ['/* this function is a callback */',
+             'RPY_REVDB_CALLBACKLOC(RPY_CALLBACKLOC_%s);' % name] +
             ['\t' + emit('/*arg*/', funcgen.lltypename(v), funcgen.expr(v))
                 for v in funcgen.graph.getargs()])
         extra_return_text = '/* RPY_CALLBACK_LEAVE(); */'
diff --git a/rpython/translator/revdb/pplog.py 
b/rpython/translator/revdb/pplog.py
--- a/rpython/translator/revdb/pplog.py
+++ b/rpython/translator/revdb/pplog.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env pypy
 
 # Post-process log files to make them diff-able.
 #
@@ -19,7 +19,9 @@
 
 r_hide_tail = re.compile(r"revdb[.]c:\d+: ([0-9a-f]+)")
 
-r_remove = re.compile("\w+[.]c:\d+: obj 92233720368")
+r_remove = re.compile(r"\w+[.]c:\d+: obj 92233720368|"
+                      r"PID \d+ starting, log file disabled|"
+                      r"\[")
 
 
 def post_process(fin, fout):
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
@@ -46,7 +46,7 @@
 
 rpy_revdb_t rpy_revdb;
 static char rpy_rev_buffer[16384];    /* max. 32768 */
-static int rpy_rev_fileno = -1;
+int rpy_rev_fileno = -1;
 static char flag_io_disabled = FID_REGULAR_MODE;
 
 
diff --git a/rpython/translator/revdb/src-revdb/revdb_include.h 
b/rpython/translator/revdb/src-revdb/revdb_include.h
--- a/rpython/translator/revdb/src-revdb/revdb_include.h
+++ b/rpython/translator/revdb/src-revdb/revdb_include.h
@@ -22,6 +22,7 @@
 } rpy_revdb_t;
 
 RPY_EXTERN rpy_revdb_t rpy_revdb;
+RPY_EXTERN int rpy_rev_fileno;
 
 
 /* ------------------------------------------------------------ */
@@ -31,19 +32,23 @@
 
 #if 0    /* enable to print locations to stderr of all the EMITs */
 #  define _RPY_REVDB_PRINT(mode, _e)                                    \
-    fprintf(stderr,                                                     \
-            "%s:%d: %0*llx\n",                                          \
-            __FILE__, __LINE__, 2 * sizeof(_e),                         \
-            ((unsigned long long)_e) & ((2ULL << (8*sizeof(_e)-1)) - 1))
+    if (rpy_rev_fileno >= 0) {                                          \
+        fprintf(stderr,                                                 \
+                "%s:%d: %0*llx\n",                                      \
+                __FILE__, __LINE__, 2 * sizeof(_e),                     \
+                ((unsigned long long)_e) & ((2ULL << (8*sizeof(_e)-1)) - 1)); \
+    }
 #endif
 
 #if 0    /* enable to print all mallocs to stderr */
 RPY_EXTERN void seeing_uid(uint64_t uid);
-#  define _RPY_REVDB_PRUID()                                    \
-    seeing_uid(uid);                                            \
-    fprintf(stderr,                                             \
-            "%s:%d: obj %llu\n",                                \
-            __FILE__, __LINE__, (unsigned long long) uid)
+#  define _RPY_REVDB_PRUID()                                            \
+    if (rpy_rev_fileno >= 0) {                                          \
+        seeing_uid(uid);                                                \
+        fprintf(stderr,                                                 \
+                "%s:%d: obj %llu\n",                                    \
+                __FILE__, __LINE__, (unsigned long long) uid);          \
+    }
 #endif
 
 #ifndef _RPY_REVDB_PRINT
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to