From 0ad7a9fd4b6fe73830533fff83762702fc163d7a Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 8 Oct 2013 14:35:30 +0800 Subject: [PATCH] issue #2823: minor fix and logs. --- .../Javascript/MoonWarriors/Classes/AppDelegate.cpp | 2 ++ .../project.pbxproj.REMOVED.git-id | 2 +- scripting/javascript/bindings/ScriptingCore.cpp | 13 ++++++------- .../bindings/js/debugger/actors/script.js | 6 ++++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp index 93dc35d856..7459b20f51 100644 --- a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp +++ b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp @@ -40,6 +40,8 @@ bool AppDelegate::applicationDidFinishLaunching() // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); + FileUtils::getInstance()->addSearchPath("js"); + ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); sc->addRegisterCallback(register_all_cocos2dx_extension); diff --git a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id index 0cf8b5aa58..0be07b5677 100644 --- a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -0017c1d76ce42fd252ff8245774d5a276e278115 \ No newline at end of file +036581b6dd46245d778816a7258c42ea68c06959 \ No newline at end of file diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 7ac446464e..5ee46eef0b 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -201,6 +201,12 @@ void js_log(const char *format, ...) { int len = vsnprintf(_js_log_buf, kMaxLogLen, format, vl); va_end(vl); if (len) { + std::string logBuf = _js_log_buf; + if (std::string::npos != logBuf.find("unknown (can't convert to") + || std::string::npos != logBuf.find("too much recursion")) + { + log("exception...."); + } CCLOG("JS: %s\n", _js_log_buf); } } @@ -2206,13 +2212,6 @@ static void clearBuffers() { } } -static int replyToClient(int socket, const std::string& buf) -{ - std::stringstream bufSend; - bufSend << buf.length() << ":" << buf; - return ::send(socket, bufSend.str().c_str(), bufSend.str().length(), 0); -} - static void serverEntryPoint(void) { // start a server, accept the connection and keep reading data from it diff --git a/scripting/javascript/bindings/js/debugger/actors/script.js b/scripting/javascript/bindings/js/debugger/actors/script.js index 2e65052e29..9d1963e379 100644 --- a/scripting/javascript/bindings/js/debugger/actors/script.js +++ b/scripting/javascript/bindings/js/debugger/actors/script.js @@ -313,6 +313,8 @@ ThreadActor.prototype = { // } // } + _unlockVM(); + if (aRequest && aRequest.forceCompletion) { // TODO: remove this when Debugger.Frame.prototype.pop is implemented in // bug 736733. @@ -329,6 +331,7 @@ ThreadActor.prototype = { } if (aRequest && aRequest.resumeLimit) { + log("resumeLimit..."); // Bind these methods because some of the hooks are called with 'this' // set to the current frame. let pauseAndRespond = (aFrame, onPacket=function (k) k) => { @@ -408,13 +411,16 @@ ThreadActor.prototype = { if (stepFrame) { switch (steppingType) { case "step": + log("--> step..."); this.dbg.onEnterFrame = onEnterFrame; // Fall through. case "next": + log("--> next..."); stepFrame.onStep = onStep; stepFrame.onPop = onPop; break; case "finish": + log("--> finish..."); stepFrame.onPop = onPop; } }