Moved breakpointWasHit inside the DebugState struct, thus resolving a FIXME

svn-id: r49071
This commit is contained in:
Filippos Karapetis 2010-05-18 09:18:27 +00:00
parent 3dda73d9a2
commit 8b7c29a4ad
5 changed files with 9 additions and 11 deletions

View file

@ -197,6 +197,7 @@ Console::Console(SciEngine *engine) : GUI::Debugger() {
g_debugState.runningStep = 0; g_debugState.runningStep = 0;
g_debugState.stopOnEvent = false; g_debugState.stopOnEvent = false;
g_debugState.debugging = false; g_debugState.debugging = false;
g_debugState.breakpointWasHit = false;
} }
Console::~Console() { Console::~Console() {

View file

@ -42,6 +42,7 @@ enum DebugSeeking {
struct DebugState { struct DebugState {
bool debugging; bool debugging;
bool breakpointWasHit;
bool stopOnEvent; bool stopOnEvent;
DebugSeeking seeking; // Stepping forward until some special condition is met DebugSeeking seeking; // Stepping forward until some special condition is met
int runningStep; // Set to > 0 to allow multiple stepping int runningStep; // Set to > 0 to allow multiple stepping

View file

@ -309,7 +309,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
} }
void script_debug(EngineState *s, bool bp) { void script_debug(EngineState *s) {
// Do we support a separate console? // Do we support a separate console?
#if 0 #if 0
@ -327,7 +327,7 @@ void script_debug(EngineState *s, bool bp) {
return; return;
#endif #endif
if (g_debugState.seeking && !bp) { // Are we looking for something special? if (g_debugState.seeking && !g_debugState.breakpointWasHit) { // Are we looking for something special?
SegmentObj *mobj = GET_SEGMENT(*s->_segMan, scriptState.xs->addr.pc.segment, SEG_TYPE_SCRIPT); SegmentObj *mobj = GET_SEGMENT(*s->_segMan, scriptState.xs->addr.pc.segment, SEG_TYPE_SCRIPT);
if (mobj) { if (mobj) {

View file

@ -54,9 +54,6 @@ int script_abort_flag = 0; // Set to 1 to abort execution. Set to 2 to force a r
int script_step_counter = 0; // Counts the number of steps executed // FIXME: Avoid non-const global vars int script_step_counter = 0; // Counts the number of steps executed // FIXME: Avoid non-const global vars
int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs // FIXME: Avoid non-const global vars int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs // FIXME: Avoid non-const global vars
static bool breakpointWasHit = false; // FIXME: Avoid non-const global vars
#define SCI_XS_CALLEE_LOCALS ((SegmentId)-1) #define SCI_XS_CALLEE_LOCALS ((SegmentId)-1)
/** /**
@ -290,7 +287,7 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
Console *con = g_sci->getSciDebugger(); Console *con = g_sci->getSciDebugger();
con->DebugPrintf("Break on script %d, export %d\n", script, pubfunct); con->DebugPrintf("Break on script %d, export %d\n", script, pubfunct);
g_debugState.debugging = true; g_debugState.debugging = true;
breakpointWasHit = true; g_debugState.breakpointWasHit = true;
break; break;
} }
} }
@ -373,8 +370,8 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
Console *con = g_sci->getSciDebugger(); Console *con = g_sci->getSciDebugger();
con->DebugPrintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj)); con->DebugPrintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj));
print_send_action = 1; print_send_action = 1;
breakpointWasHit = true;
g_debugState.debugging = true; g_debugState.debugging = true;
g_debugState.breakpointWasHit = true;
break; break;
} }
} }
@ -814,8 +811,8 @@ void run_vm(EngineState *s, bool restoring) {
// Debug if this has been requested: // Debug if this has been requested:
// TODO: re-implement sci_debug_flags // TODO: re-implement sci_debug_flags
if (g_debugState.debugging /* sci_debug_flags*/) { if (g_debugState.debugging /* sci_debug_flags*/) {
script_debug(s, breakpointWasHit); script_debug(s);
breakpointWasHit = false; g_debugState.breakpointWasHit = false;
} }
Console *con = g_sci->getSciDebugger(); Console *con = g_sci->getSciDebugger();
if (con->isAttached()) { if (con->isAttached()) {

View file

@ -367,9 +367,8 @@ void run_vm(EngineState *s, bool restoring);
/** /**
* Debugger functionality * Debugger functionality
* @param[in] s The state at which debugging should take place * @param[in] s The state at which debugging should take place
* @param[in] bp Flag, set to true when a breakpoint is triggered
*/ */
void script_debug(EngineState *s, bool bp); void script_debug(EngineState *s);
/** /**
* Initializes a EngineState block * Initializes a EngineState block