Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random crashes during Corona debugging #387

Closed
srdjan-m opened this issue Dec 23, 2014 · 6 comments
Closed

Random crashes during Corona debugging #387

srdjan-m opened this issue Dec 23, 2014 · 6 comments
Assignees

Comments

@srdjan-m
Copy link

I am getting random crashes on variable rollover at the breakpoint pause.
It is very convenient way of var inspection and I am using it quite often but recently (prev version?) ZBS started to crash randomly whenever I try to inspect the variable by hovering cursor on top of it.

Here is the error report:
/Users/Prvi/Documents/Srdjan/sourcetree/dre-new/modules/choicesgen.lua:341: /Users/Prvi/Documents/Srdjan/sourcetree/dre-new/mobdebug.lua:774: attempt to get length of local 'res' (a nil value)
stack traceback:
[C]: in function 'error'
/Users/Prvi/Documents/Srdjan/sourcetree/dre-new/mobdebug.lua:651: in function </Users/Prvi/Documents/Srdjan/sourcetree/dre-new/mobdebug.lua:491>
/Users/Prvi/Documents/Srdjan/sourcetree/dre-new/modules/choicesgen.lua:341: in function </Users/Prvi/Documents/Srdjan/sourcetree/dre-new/modules/choicesgen.lua:206>
?: in function <?:221>
2014-12-23 23:59:51.790 Corona Simulator[5353:507] ERROR: loadstring() is not available b/c the parser is not loaded.
Debugging session completed (traced 1 instruction).
Program completed in 160.49 seconds (pid: 5353).

@pkulchenko pkulchenko self-assigned this Dec 24, 2014
@pkulchenko
Copy link
Owner

@srdjan-m, I'll patch mobdebug to avoid throwing the error, but this doesn't fix the underlying issue and it doesn't seem to be coming from ZBS. Given this message "ERROR: loadstring() is not available b/c the parser is not loaded.", it seems to be coming from Corona; is it possible that the new Corona version you are using sporadically refuses to call "loadstring"? This would explain the symptoms. What version of Corona SDK is that?

@pkulchenko
Copy link
Owner

@srdjan-m, here is the diff that may fix the thrown error:

diff --git a/lualibs/mobdebug/mobdebug.lua b/lualibs/mobdebug/mobdebug.lua
index d8d276b..1891f70 100644
--- a/lualibs/mobdebug/mobdebug.lua
+++ b/lualibs/mobdebug/mobdebug.lua
@@ -771,6 +771,8 @@ local function debugger_loop(sev, svars, sfile, sline)
           server:send("200 OK " .. #res .. "\n")
           server:send(res)
         else
+          -- fix error if not set (for example, when loadstring is not present)
+          if not res then res = "Unknown error" end
           server:send("401 Error in Expression " .. #res .. "\n")
           server:send(res)
         end

@srdjan-m
Copy link
Author

I am using the latest public build: 2014.2511.
I'll give your fix a try soon...

@pkulchenko
Copy link
Owner

@srdjan-m, thank you! With the fix, you should see a (proper) error message in the tooltip instead of an (improper) error message in the popup.

@srdjan-m
Copy link
Author

Yes, I am getting:
2014-12-24 13:13:50.638 Corona Simulator[14483:507] ERROR: loadstring() is not available b/c the parser is not loaded.
And tooltip shows "Unknown error".

Strange thing is that in most situations, tooltip shows the correct values and it works ok.
I am still unable to reproduce necessary steps which lead to this crash...

@pkulchenko
Copy link
Owner

@srdjan-m, thank you for confirming the fix. Just to make sure I understand: the same tooltip works one time and doesn't work some other time, right?

Here is some additional information I got from Perry Clarke (Corona):

There were some changes to the way the debugger displays variables which I guess might account for the issues you are seeing (we haven’t consciously done anything with loadstring(), it’s still only disabled if the debugger is not connected, i.e. the Simulator was started without "-debug YES").

I suggest trying the "debugger" utility that comes with CoronaSDK (which is horrible but is just a raw command line interface to the debugger engine so is useful for testing some things) and issuing whatever commands your IDE sends when the user "inspect[s] the variable by hovering cursor on top of it" and seeing what is returned (the string "DEBUGGER: " is printed by the client not sent by the Simulator). For example:

> > dump msg
> msg = (string) "bug-perf"

It would be great if you could give this a try when you get the error next time. I'm wondering if Corona reports the same issue as well. None of this will fix it, but having additional information I can forward them may help. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants