[Scummvm-cvs-logs] CVS: scummvm/common debugger.cpp,1.6,1.7 debugger.h,1.5,1.6

Max Horn fingolfin at users.sourceforge.net
Sun Aug 8 15:45:03 CEST 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4567/common

Modified Files:
	debugger.cpp debugger.h 
Log Message:
Fixed variable access in the debugger

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/debugger.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- debugger.cpp	24 Feb 2004 22:39:38 -0000	1.6
+++ debugger.cpp	8 Aug 2004 22:44:14 -0000	1.7
@@ -186,10 +186,14 @@
 				// Alright, we need to check the TYPE of the variable to deref and stuff... the array stuff is a bit ugly :)
 				switch(_dvars[i].type) {
 				// Integer
+				case DVAR_BYTE:
+					*(byte *)_dvars[i].variable = atoi(param[1]);
+					DebugPrintf("byte%s = %d\n", param[0], *(byte *)_dvars[i].variable);
+					break;
 				case DVAR_INT:
 					*(int *)_dvars[i].variable = atoi(param[1]);
 					DebugPrintf("(int)%s = %d\n", param[0], *(int *)_dvars[i].variable);
-				break;
+					break;
 				// Integer Array
 				case DVAR_INTARRAY: {
 					char *chr = strchr(param[0], '[');
@@ -198,15 +202,15 @@
 					} else {
 						int element = atoi(chr+1);
 						int32 *var = *(int32 **)_dvars[i].variable;
-						if (element > _dvars[i].optional) {
+						if (element >= _dvars[i].optional) {
 							DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
 						} else {
 							var[element] = atoi(param[1]);
 							DebugPrintf("(int)%s = %d\n", param[0], var[element]);
 						}
 					}
-				}
-				break;
+					}
+					break;
 				default:
 					DebugPrintf("Failed to set variable %s to %s - unknown type\n", _dvars[i].name, param[1]);
 					break;
@@ -215,9 +219,12 @@
 				// And again, type-dependent prints/defrefs. The array one is still ugly.
 				switch(_dvars[i].type) {
 				// Integer
+				case DVAR_BYTE:
+					DebugPrintf("(byte)%s = %d\n", param[0], *(byte *)_dvars[i].variable);
+					break;
 				case DVAR_INT:
 					DebugPrintf("(int)%s = %d\n", param[0], *(int *)_dvars[i].variable);
-				break;
+					break;
 				// Integer array
 				case DVAR_INTARRAY: {
 					char *chr = strchr(param[0], '[');
@@ -225,8 +232,8 @@
 						DebugPrintf("You must access this array as %s[element]\n", param[0]);
 					} else {
 						int element = atoi(chr+1);
-						int16 *var = *(int16 **)_dvars[i].variable;
-						if (element > _dvars[i].optional) {
+						int32 *var = *(int32 **)_dvars[i].variable;
+						if (element >= _dvars[i].optional) {
 							DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional);
 						} else {
 							DebugPrintf("(int)%s = %d\n", param[0], var[element]);

Index: debugger.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/debugger.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- debugger.h	6 Jan 2004 12:45:27 -0000	1.5
+++ debugger.h	8 Aug 2004 22:44:15 -0000	1.6
@@ -47,6 +47,7 @@
 	typedef bool (T::*DebugProc)(int argc, const char **argv);
 	
 	enum {
+		DVAR_BYTE,
 		DVAR_INT,
 		DVAR_BOOL,
 		DVAR_INTARRAY,





More information about the Scummvm-git-logs mailing list