Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 2677d39

Browse files
committed
[[ Bug 13110 ]] Debugger triggers when using 'do'.
The debugger will trigger a breakpoint on the first few lines of a script when a do is executed in the context of the same object. Essentially, the check for breakpoints gets confused in this case so if you do script has 3 lines, and you have a breakpoint in the first 3 lines of the objects script, you'll get a debug-break action. This has been fixed by guarding MCB_trace against doing anything if within a handler called 'message' - which is what do uses for this purpose.
1 parent 9abc687 commit 2677d39

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

engine/src/debug.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,13 @@ void MCB_prepmessage(MCExecContext &ctxt, MCNameRef mess, uint2 line, uint2 pos,
269269
void MCB_trace(MCExecContext &ctxt, uint2 line, uint2 pos)
270270
{
271271
uint2 i;
272-
273-
if (MCtrace && (MCtraceuntil == MAXUINT2 || MCnexecutioncontexts == MCtraceuntil))
272+
273+
// MW-2015-03-03: [[ Bug 13110 ]] If this is an internal handler as a result of do
274+
// then *don't* debug it.
275+
if (ctxt . GetHandler() -> getname() == MCM_message)
276+
return;
277+
278+
if (MCtrace && (MCtraceuntil == MAXUINT2 || MCnexecutioncontexts == MCtraceuntil))
274279
{
275280
MCtraceuntil = MAXUINT2;
276281
MCB_prepmessage(ctxt, MCM_trace, line, pos, 0);
@@ -285,9 +290,9 @@ void MCB_trace(MCExecContext &ctxt, uint2 line, uint2 pos)
285290
{
286291
MCParentScriptUse *t_parentscript;
287292
t_parentscript = ctxt . GetParentScript();
288-
if (t_parentscript == NULL && MCbreakpoints[i].object == ctxt.GetObject() ||
289-
t_parentscript != NULL && MCbreakpoints[i].object == t_parentscript -> GetParent() -> GetObject())
290-
MCB_prepmessage(ctxt, MCM_trace_break, line, pos, 0, MCbreakpoints[i].info);
293+
if ((t_parentscript == NULL && MCbreakpoints[i].object == ctxt.GetObject()) ||
294+
(t_parentscript != NULL && MCbreakpoints[i].object == t_parentscript -> GetParent() -> GetObject()))
295+
MCB_prepmessage(ctxt, MCM_trace_break, line, pos, 0, MCbreakpoints[i].info);
291296
}
292297
}
293298
}

0 commit comments

Comments
 (0)