[pypy-commit] pypy default: implement debug_flush and debug_offset for the CLI backend; fixes test_debug_print_start_stop
antocuni
noreply at buildbot.pypy.org
Fri May 27 10:34:10 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r44530:2f018cf95032
Date: 2011-05-27 10:46 +0200
http://bitbucket.org/pypy/pypy/changeset/2f018cf95032/
Log: implement debug_flush and debug_offset for the CLI backend; fixes
test_debug_print_start_stop
diff --git a/pypy/translator/cli/opcodes.py b/pypy/translator/cli/opcodes.py
--- a/pypy/translator/cli/opcodes.py
+++ b/pypy/translator/cli/opcodes.py
@@ -84,6 +84,8 @@
'debug_reraise_traceback': Ignore,
'debug_print_traceback': Ignore,
'debug_print': [DebugPrint],
+ 'debug_flush': [PushAllArgs, 'call void [pypylib]pypy.runtime.DebugPrint::DEBUG_FLUSH()'],
+ 'debug_offset': [PushAllArgs, 'call int32 [pypylib]pypy.runtime.DebugPrint::DEBUG_OFFSET()'],
'debug_start': [PushAllArgs, 'call void [pypylib]pypy.runtime.DebugPrint::DEBUG_START(string)'],
'debug_stop': [PushAllArgs, 'call void [pypylib]pypy.runtime.DebugPrint::DEBUG_STOP(string)'],
'have_debug_prints': [PushAllArgs, 'call bool [pypylib]pypy.runtime.DebugPrint::HAVE_DEBUG_PRINTS()'],
diff --git a/pypy/translator/cli/src/debug.cs b/pypy/translator/cli/src/debug.cs
--- a/pypy/translator/cli/src/debug.cs
+++ b/pypy/translator/cli/src/debug.cs
@@ -38,6 +38,20 @@
return false;
}
+ public static void DEBUG_FLUSH()
+ {
+ if (debug_file != null)
+ debug_file.Flush();
+ }
+
+ public static int DEBUG_OFFSET()
+ {
+ StreamWriter sw = debug_file as StreamWriter;
+ if (sw == null)
+ return -1;
+ return (int)sw.BaseStream.Position; // XXX: the cast might be incorrect
+ }
+
public static bool HAVE_DEBUG_PRINTS()
{
if ((have_debug_prints & 1) != 0) {
More information about the pypy-commit
mailing list