[pypy-commit] pypy reverse-debugger: Debugging helper
arigo
pypy.commits at gmail.com
Sat Jul 2 04:26:12 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r85513:6b5aaea0d7f0
Date: 2016-07-02 10:27 +0200
http://bitbucket.org/pypy/pypy/changeset/6b5aaea0d7f0/
Log: Debugging helper
diff --git a/rpython/translator/revdb/pplog.py b/rpython/translator/revdb/pplog.py
new file mode 100755
--- /dev/null
+++ b/rpython/translator/revdb/pplog.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python2
+
+# Post-process log files to make them diff-able.
+#
+# When you get errors caused by revdb.py getting out of sync with the
+# original log file, recompile the program (e.g. pypy-c) by editing
+# revdb_include.h, enabling the "#if 0" (at least the first one,
+# possibly the second one too). This prints locations to stderr of
+# all the EMITs. Then create the log file by redirecting stderr to
+# "log.err1", and then run revdb.py by redirecting stderr to
+# "log.err2" (typically, entering the "c" command to continue to the
+# end). Then diff them both after applying this filter:
+#
+# diff -u <(cat log.err1 | .../rpython/translator/revdb/pplog.py) \
+# <(cat log.err2 | .../rpython/translator/revdb/pplog.py) | less
+
+
+import sys, re
+
+r_hide_tail = re.compile(r"revdb[.]c:\d+: ([0-9a-f]+)")
+
+r_remove = re.compile("\w+[.]c:\d+: obj 92233720368")
+
+
+def post_process(fin, fout):
+ for line in fin:
+ match = r_hide_tail.match(line)
+ if match:
+ line = 'revdb.c:after pplog.py: %s\n' % ('#' * len(match.group(1)),)
+ elif r_remove.match(line):
+ continue
+ fout.write(line)
+
+
+if __name__ == '__main__':
+ post_process(sys.stdin, sys.stdout)
diff --git a/rpython/translator/revdb/revdb.py b/rpython/translator/revdb/revdb.py
--- a/rpython/translator/revdb/revdb.py
+++ b/rpython/translator/revdb/revdb.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys, os
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
@@ -1326,6 +1326,4 @@
RPY_EXTERN
void seeing_uid(uint64_t uid)
{
- if (uid == 1895569)
- attach_gdb();
}
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
@@ -29,7 +29,7 @@
RPY_EXTERN void rpy_reverse_db_setup(int *argc_p, char **argv_p[]);
RPY_EXTERN void rpy_reverse_db_teardown(void);
-#if 0 /* enable to print locations to stderr of all the EMITs */
+#if 1 /* enable to print locations to stderr of all the EMITs */
# define _RPY_REVDB_PRINT(mode) \
fprintf(stderr, \
"%s:%d: %0*llx\n", \
@@ -37,7 +37,8 @@
((unsigned long long)_e) & ((2ULL << (8*sizeof(_e)-1)) - 1))
#endif
-#if 0 /* enable to print all allocs to stderr */
+#if 1 /* enable to print all allocs to stderr */
+RPY_EXTERN void seeing_uid(uint64_t uid);
# define _RPY_REVDB_PRUID() \
seeing_uid(uid); \
fprintf(stderr, \
More information about the pypy-commit
mailing list