Subject: fix INST_YIELD so that it works

From: mig <mig>
Date: Sun, 28 Oct 2012 18:58:20 +0000

---
 generic/tclExecute.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 30f8d77..b42e4ab 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2345,17 +2345,33 @@ TEBCresume(
 	    goto gotError;
 	}
 
-	Tcl_SetObjResult(interp, OBJ_AT_TOS);
-	TclNRAddCallback(interp, TclNRCoroutineActivateCallback, corPtr,
-		INT2PTR(0), NULL, NULL);
-
 #ifdef TCL_COMPILE_DEBUG
 	TRACE_WITH_OBJ(("yield, result="), iPtr->objResultPtr);
 	if (traceInstructions) {
 	    fprintf(stdout, "\n");
 	}
 #endif
-	goto checkForCatch;
+	/* TIP #280: Record the last piece of info needed by
+	 * 'TclGetSrcInfoForPc', and push the frame.
+	 */
+	
+	bcFramePtr->data.tebc.pc = (char *) pc;
+	iPtr->cmdFramePtr = bcFramePtr;
+
+	if (iPtr->flags & INTERP_DEBUG_FRAME) {
+	    TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc,
+		    codePtr, bcFramePtr, pc - codePtr->codeStart);
+	}
+
+	pc++;
+	cleanup = 1;
+	TEBC_YIELD();
+	
+	Tcl_SetObjResult(interp, OBJ_AT_TOS);
+	TclNRAddCallback(interp, TclNRCoroutineActivateCallback, corPtr,
+		INT2PTR(0), NULL, NULL);
+
+	return TCL_OK;
     }
 
     case INST_DONE:
-- 
cgit v0.12