[pypy-svn] r59064 - pypy/dist/pypy/lang/gameboy/debug
cami at codespeak.net
cami at codespeak.net
Mon Oct 13 11:41:25 CEST 2008
Author: cami
Date: Mon Oct 13 11:41:23 2008
New Revision: 59064
Modified:
pypy/dist/pypy/lang/gameboy/debug/debug.py
pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py
pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_implementation.py
Log:
debuger prints now the function names
Modified: pypy/dist/pypy/lang/gameboy/debug/debug.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/debug/debug.py (original)
+++ pypy/dist/pypy/lang/gameboy/debug/debug.py Mon Oct 13 11:41:23 2008
@@ -1,4 +1,6 @@
import operator
+from pypy.lang.gameboy import cpu
+import pdb
DEBUG = True
DEBUG_PRINT_LOGS = True
@@ -86,16 +88,17 @@
CHECKED_OP_CODES = [0x00]
CHECKED_FETCH_OP_CODES = []
+BAR_WIDTH = 79
def log(opCode, is_fetch_execute=False):
global COUNT, op_codes, fetch_execute_op_codes
if DEBUG_PRINT_LOGS:
- print "="*40
+ print "=" * BAR_WIDTH
if is_fetch_execute:
- print COUNT[0], " FETCH EXEC: %i | %s" % (opCode, hex(opCode))
+ print COUNT[0], " FETCH EXEC: %i | %s | %s" % (opCode, hex(opCode), resolve_fetch_opcode_name(opCode))
else:
- print COUNT[0], " EXEC: %i | %s" % (opCode, hex(opCode))
- print "-"*40
+ print COUNT[0], " EXEC: %i | %s | %s" % (opCode, hex(opCode), resolve_opcode_name(opCode))
+ print "-" * BAR_WIDTH
if is_fetch_execute:
fetch_execute_op_codes[opCode ]+= 1
@@ -105,7 +108,27 @@
#if COUNT % 1000 == 0:
# print "."
-
+def resolve_opcode_name(opcode):
+ method = cpu.OP_CODES[opcode].__name__
+ if method == "<lambda>":
+ try:
+ functions = "[ "
+ for func_closure in cpu.OP_CODES[opcode].func_closure:
+ functions += func_closure.cell_contents.im_func.__name__+ ", ";
+ return functions + "]";
+ except:
+ return cpu.OP_CODES[opcode].func_code.co_names;
+ else:
+ return method;
+
+def resolve_fetch_opcode_name(opcode):
+ method = cpu.OP_CODES[opcode].__name__
+ if method == "<lambda>":
+ pdb.set_trace()
+ else:
+ return method;
+
+
def print_results():
global COUNT, op_codes, fetch_execute_op_codes
Modified: pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py (original)
+++ pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_entry_point.py Mon Oct 13 11:41:23 2008
@@ -53,11 +53,12 @@
JMARIO_DIR = str(py.magic.autopath().dirpath().dirpath()\
.dirpath().dirpath()\
.dirpath().dirpath()) + "/jmario"
-JAVA_CLASSPATH =[JMARIO_DIR+"/bin/", JMARIO_DIR+"/build/",
- JMARIO_DIR+"/lib/xmlrpc-client-3.1.jar",
- JMARIO_DIR+"/lib/xmlrpc-common-3.1.jar",
- JMARIO_DIR+"/lib/ws-commons-util-1.0.2.jar",
- JMARIO_DIR+"/lib/commons-logging-1.1.jar"];
+
+JAVA_CLASSPATH =[ JMARIO_DIR + "/bin/", JMARIO_DIR+"/build/",
+ JMARIO_DIR + "/lib/xmlrpc-client-3.1.jar",
+ JMARIO_DIR + "/lib/xmlrpc-common-3.1.jar",
+ JMARIO_DIR + "/lib/ws-commons-util-1.0.2.jar",
+ JMARIO_DIR + "/lib/commons-logging-1.1.jar"];
def start_java_version():
global filename
@@ -77,7 +78,7 @@
# START ========================================================================
parse_file_name()
-threading.Timer(1, start_java_version).start()
-threading.Timer(0.001, start_python_version()).start()
+threading.Timer(1, start_java_version ).start()
+threading.Timer(0, start_python_version()).start()
Modified: pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_implementation.py
==============================================================================
--- pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_implementation.py (original)
+++ pypy/dist/pypy/lang/gameboy/debug/gameboy_debug_implementation.py Mon Oct 13 11:41:23 2008
@@ -32,7 +32,6 @@
self.emulate(constants.GAMEBOY_CLOCK >> 2)
def handle_execution_error(self, error):
- GameBoyImplementation.handle_execution_error(self, error)
print error
print "closing socket connections"
pdb.set_trace()
More information about the Pypy-commit
mailing list