pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.61k stars 519 forks source link

Debugging main fragment with `coroutine.yield` call aborts debugging even when wrapped into pcall #1066

Closed WanChuanwei closed 4 years ago

WanChuanwei commented 4 years ago

select lua 5.2 for Lua Interpreter. a lua fragment code is as follows: f1 = function() print("001") coroutine.yield() return 100 end print(pcall(f1)) print(002) if run it, the result maybe is: false attempt to yield from outside a coroutine 2 but if debug it using stepping into, when IDE executes the sentence "coroutine.yield", the debugging ends. I have tested another lua debugging software, it executes the sentence "coroutine.yield" and executes "print(002)" next step, the result is same as running the upper lua fragment.

pkulchenko commented 4 years ago

@WanChuanwei, thank you for the report. This is a feature of how the debugger is working. See #801 for the details on when this message was introduced, the explanation, and a workaround.

WanChuanwei commented 4 years ago

Thank you very much for resolving the problem for me so quickly。But there is a little problem with smooth operation。After Starting ZeroBraneStudio with a lua script including "require('mobdebug').start()" at the beginning, run the script at first, the IDE running process is the same as running the script without "require('mobdebug').start()" at the beginning. But once choise “strat debugging” to run the script, the following IDE running process of running the script is different after that. And now the IDE running process approximately is: Running the script leads to debugging the script. the version of ZeroBraneStudio that i use is not the final version currently, maybe some ZeroBraneStudios are not so.