[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.19,1.20 script.cpp,1.55,1.56 scumm.h,1.164,1.165 scummvm.cpp,2.94,2.95

Jonathan Gray khalek at users.sourceforge.net
Sun Apr 20 01:05:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv27631

Modified Files:
	debugger.cpp script.cpp scumm.h scummvm.cpp 
Log Message:
add stack tracing option to debugger

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- debugger.cpp	20 Apr 2003 06:55:09 -0000	1.19
+++ debugger.cpp	20 Apr 2003 08:04:26 -0000	1.20
@@ -334,6 +334,11 @@
 	if (!strcmp(argv[1], "hex")) {
 		_s->_hexdumpScripts = true;
 		Debug_Printf("Script hex dumping on\n");
+	} else if (!strncmp(argv[1], "sta", 3)) {
+		_s->_showStack = true;
+		Debug_Printf("Stack tracing on\n");
+	} else {
+		Debug_Printf("Unknown show parameter '%s'\n", argv[1]);
 	}
 	return true;
 }
@@ -348,6 +353,11 @@
 	if (!strcmp(argv[1], "hex")) {
 		_s->_hexdumpScripts = false;
 		Debug_Printf("Script hex dumping off\n");
+	} else if (!strncmp(argv[1], "sta", 3)) {
+		_s->_showStack = false;
+		Debug_Printf("Stack tracing off\n");
+	} else {
+		Debug_Printf("Unknown hide parameter '%s'\n", argv[1]);
 	}
 	return true;
 }

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- script.cpp	20 Apr 2003 06:55:08 -0000	1.55
+++ script.cpp	20 Apr 2003 08:04:26 -0000	1.56
@@ -277,16 +277,29 @@
 
 /* Execute a script - Read opcode, and execute it from the table */
 void Scumm::executeScript() {
+	int c;
 	while (_currentScript != 0xFF) {
+		
+		if (_showStack == true) {
+			printf("Stack:");
+			for (c=0; c < _scummStackPos; c++) {
+				printf(" %d", _scummStack[c]); 
+			}
+			printf("\n");
+		}
 		_opcode = fetchScriptByte();
 		vm.slot[_currentScript].didexec = 1;
-		debug(7, "Script %d, offset 0x%x: [%X] %s()",
+		debug(7, " Script %d, offset 0x%x: [%X] %s()",
 				vm.slot[_currentScript].number,
 				_scriptPointer - _scriptOrgPointer,
 				_opcode,
 				getOpcodeDesc(_opcode));
-		if (_hexdumpScripts == true)
-			hexdump(_scriptPointer - 1, 8);
+		if (_hexdumpScripts == true) {
+			for (c= -1; c < 15; c++) {
+				printf(" %02x", *(_scriptPointer + c));
+			}
+			printf("\n");
+		}
 		executeOpcode(_opcode);
 	}
 	CHECK_HEAP;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- scumm.h	20 Apr 2003 06:55:09 -0000	1.164
+++ scumm.h	20 Apr 2003 08:04:27 -0000	1.165
@@ -420,7 +420,7 @@
 
 	int16 _virtual_mouse_x, _virtual_mouse_y;
 	int _bootParam;
-	bool _dumpScripts, _hexdumpScripts;
+	bool _dumpScripts, _hexdumpScripts, _showStack;
 	uint16 _debugMode, _soundCardType;
 
 	/* Not sure where this stuff goes */

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.94
retrieving revision 2.95
diff -u -d -r2.94 -r2.95
--- scummvm.cpp	20 Apr 2003 06:55:09 -0000	2.94
+++ scummvm.cpp	20 Apr 2003 08:04:27 -0000	2.95
@@ -203,6 +203,7 @@
 	_dynamicRoomOffsets = 0;
 	_shakeEnabled = 0;
 	_hexdumpScripts = 0;
+	_showStack = 0;
 
 	if (_gameId == GID_ZAK256) {	// FmTowns is 320x240
 		_realWidth = 320;





More information about the Scummvm-git-logs mailing list