[Scummvm-cvs-logs] SF.net SVN: scummvm:[49092] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed May 19 09:25:06 CEST 2010


Revision: 49092
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49092&view=rev
Author:   thebluegr
Date:     2010-05-19 07:25:06 +0000 (Wed, 19 May 2010)

Log Message:
-----------
Moved the breakpoint information inside the DebugState struct

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/debug.h
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/engine/vm.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/console.cpp	2010-05-19 07:25:06 UTC (rev 49092)
@@ -197,6 +197,8 @@
 	g_debugState.stopOnEvent = false;
 	g_debugState.debugging = false;
 	g_debugState.breakpointWasHit = false;
+	g_debugState._breakpoints.clear(); // No breakpoints defined
+	g_debugState._activeBreakpointTypes = 0;
 }
 
 Console::~Console() {
@@ -2380,8 +2382,8 @@
 
 	DebugPrintf("Breakpoint list:\n");
 
-	Common::List<Breakpoint>::const_iterator bp = _engine->_gamestate->_breakpoints.begin();
-	Common::List<Breakpoint>::const_iterator end = _engine->_gamestate->_breakpoints.end();
+	Common::List<Breakpoint>::const_iterator bp = g_debugState._breakpoints.begin();
+	Common::List<Breakpoint>::const_iterator end = g_debugState._breakpoints.end();
 	for (; bp != end; ++bp) {
 		DebugPrintf("  #%i: ", i);
 		switch (bp->type) {
@@ -2410,8 +2412,8 @@
 	const int idx = atoi(argv[1]);
 
 	// Find the breakpoint at index idx.
-	Common::List<Breakpoint>::iterator bp = _engine->_gamestate->_breakpoints.begin();
-	const Common::List<Breakpoint>::iterator end = _engine->_gamestate->_breakpoints.end();
+	Common::List<Breakpoint>::iterator bp = g_debugState._breakpoints.begin();
+	const Common::List<Breakpoint>::iterator end = g_debugState._breakpoints.end();
 	for (int i = 0; bp != end && i < idx; ++bp, ++i) {
 		// do nothing
 	}
@@ -2422,15 +2424,15 @@
 	}
 
 	// Delete it
-	_engine->_gamestate->_breakpoints.erase(bp);
+	g_debugState._breakpoints.erase(bp);
 
 	// Update EngineState::_activeBreakpointTypes.
 	int type = 0;
-	for (bp = _engine->_gamestate->_breakpoints.begin(); bp != end; ++bp) {
+	for (bp = g_debugState._breakpoints.begin(); bp != end; ++bp) {
 		type |= bp->type;
 	}
 
-	_engine->_gamestate->_activeBreakpointTypes = type;
+	g_debugState._activeBreakpointTypes = type;
 
 	return true;
 }
@@ -2452,8 +2454,8 @@
 	bp.type = BREAK_SELECTOR;
 	bp.name = argv[1];
 
-	_engine->_gamestate->_breakpoints.push_back(bp);
-	_engine->_gamestate->_activeBreakpointTypes |= BREAK_SELECTOR;
+	g_debugState._breakpoints.push_back(bp);
+	g_debugState._activeBreakpointTypes |= BREAK_SELECTOR;
 
 	return true;
 }
@@ -2473,8 +2475,8 @@
 	bp.type = BREAK_EXPORT;
 	bp.address = (atoi(argv[1]) << 16 | atoi(argv[2]));
 
-	_engine->_gamestate->_breakpoints.push_back(bp);
-	_engine->_gamestate->_activeBreakpointTypes |= BREAK_EXPORT;
+	g_debugState._breakpoints.push_back(bp);
+	g_debugState._activeBreakpointTypes |= BREAK_EXPORT;
 
 	return true;
 }

Modified: scummvm/trunk/engines/sci/debug.h
===================================================================
--- scummvm/trunk/engines/sci/debug.h	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/debug.h	2010-05-19 07:25:06 UTC (rev 49092)
@@ -31,6 +31,27 @@
 
 namespace Sci {
 
+// These types are used both as identifiers and as elements of bitfields
+enum BreakpointType {
+	/**
+	 * Break when selector is executed. data contains (char *) selector name
+	 * (in the format Object::Method)
+	 */
+	BREAK_SELECTOR = 1,
+
+	/**
+	 * Break when an exported function is called. data contains
+	 * script_no << 16 | export_no.
+	 */
+	BREAK_EXPORT = 2
+};
+
+struct Breakpoint {
+	BreakpointType type;
+	uint32 address;  ///< Breakpoints on exports
+	Common::String name; ///< Breakpoints on selector names
+};
+
 enum DebugSeeking {
 	kDebugSeekNothing = 0,
 	kDebugSeekCallk = 1,        // Step forward until callk is found
@@ -50,6 +71,8 @@
 	int seekSpecial;			// Used for special seeks
 	int old_pc_offset;
 	StackPtr old_sp;
+	Common::List<Breakpoint> _breakpoints;   //< List of breakpoints
+	int _activeBreakpointTypes;  //< Bit mask specifying which types of breakpoints are active
 };
 
 // Various global variables used for debugging are declared here

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2010-05-19 07:25:06 UTC (rev 49092)
@@ -218,9 +218,6 @@
 
 	s->restarting_flags = SCI_GAME_IS_NOT_RESTARTING;
 
-	s->_breakpoints.clear(); // No breakpoints defined
-	s->_activeBreakpointTypes = 0;
-
 	if (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE)
 		s->_segMan->setExportAreWide(true);
 	else

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-05-19 07:25:06 UTC (rev 49092)
@@ -996,10 +996,6 @@
 	if (retval->_voc)
 		retval->_voc->parser_base = make_reg(s->sys_strings_segment, SYS_STRING_PARSER_BASE);
 
-	// Copy breakpoint information from current game instance
-	retval->_breakpoints = s->_breakpoints;
-	retval->_activeBreakpointTypes = s->_activeBreakpointTypes;
-
 	retval->successor = NULL;
 	retval->_gameId = s->_gameId;
 

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-05-19 07:25:06 UTC (rev 49092)
@@ -94,7 +94,6 @@
 
 	script_000 = 0;
 
-	_activeBreakpointTypes = 0;
 	sys_strings_segment = 0;
 	sys_strings = 0;
 

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-05-19 07:25:06 UTC (rev 49092)
@@ -157,10 +157,6 @@
 	uint16 currentRoomNumber() const;
 	void setRoomNumber(uint16 roomNumber);
 
-	/* Debugger data: */
-	Common::List<Breakpoint> _breakpoints;   /**< List of breakpoints */
-	int _activeBreakpointTypes;  /**< Bit mask specifying which types of breakpoints are active */
-
 	/* System strings */
 	SegmentId sys_strings_segment;
 	SystemStrings *sys_strings;

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-05-19 07:25:06 UTC (rev 49092)
@@ -275,13 +275,13 @@
 	}
 
 	// Check if a breakpoint is set on this method
-	if (s->_activeBreakpointTypes & BREAK_EXPORT) {
+	if (g_debugState._activeBreakpointTypes & BREAK_EXPORT) {
 		uint32 bpaddress;
 
 		bpaddress = (script << 16 | pubfunct);
 
 		Common::List<Breakpoint>::const_iterator bp;
-		for (bp = s->_breakpoints.begin(); bp != s->_breakpoints.end(); ++bp) {
+		for (bp = g_debugState._breakpoints.begin(); bp != g_debugState._breakpoints.end(); ++bp) {
 			if (bp->type == BREAK_EXPORT && bp->address == bpaddress) {
 				Console *con = g_sci->getSciDebugger();
 				con->DebugPrintf("Break on script %d, export %d\n", script, pubfunct);
@@ -354,13 +354,13 @@
 		}
 
 		// Check if a breakpoint is set on this method
-		if (s->_activeBreakpointTypes & BREAK_SELECTOR) {
+		if (g_debugState._activeBreakpointTypes & BREAK_SELECTOR) {
 			char method_name[256];
 
 			sprintf(method_name, "%s::%s", s->_segMan->getObjectName(send_obj), g_sci->getKernel()->getSelectorName(selector).c_str());
 
 			Common::List<Breakpoint>::const_iterator bp;
-			for (bp = s->_breakpoints.begin(); bp != s->_breakpoints.end(); ++bp) {
+			for (bp = g_debugState._breakpoints.begin(); bp != g_debugState._breakpoints.end(); ++bp) {
 				int cmplen = bp->name.size();
 				if (bp->name.lastChar() != ':')
 					cmplen = 256;

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2010-05-19 06:53:47 UTC (rev 49091)
+++ scummvm/trunk/engines/sci/engine/vm.h	2010-05-19 07:25:06 UTC (rev 49092)
@@ -277,28 +277,6 @@
  */
 extern ScriptState scriptState;
 
-
-// These types are used both as identifiers and as elements of bitfields
-enum BreakpointType {
-	/**
-	 * Break when selector is executed. data contains (char *) selector name
-	 * (in the format Object::Method)
-	 */
-	BREAK_SELECTOR = 1,
-
-	/**
-	 * Break when an exported function is called. data contains
-	 * script_no << 16 | export_no.
-	 */
-	BREAK_EXPORT = 2
-};
-
-struct Breakpoint {
-	BreakpointType type;
-	uint32 address;  ///< Breakpoints on exports
-	Common::String name; ///< Breakpoints on selector names
-};
-
 /**
  * Set this to 1 to abort script execution immediately. Aborting will
  * leave the debug exec stack intact.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list