-
Notifications
You must be signed in to change notification settings - Fork 192
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
Need mobdebug method to get current status #20
Comments
Agree; what do you mean by "is debug on"? I checked the discussion, but couldn't try figure out how this is going to be used. It's easy to check if there is an active connection, but I'm not sure what else may be needed. |
Is debug hook set or not (for current coroutine).
You mean it's easy to implementate? |
Yes.
No I can probably create a function ( Does this cover all your needs? How would you use it? |
I want to control debugging from client side.
It seems that I can just use
Maybe it is even excessive.
Yes, this is absolutely needed. |
I thought about it, but it's not that easy, as there is a difference between Lua (which has hook per thread) and LuaJIT (which has one hook for all threads), so you are going to get different results. Mobdebug hides the difference and does the right thing, but you'd need to re-implement the same logic and would need to have access to some internal structures. There was another reason, but it escapes me at the moment.
It may work, but notice that it checks for coro_debugger to be in both "running" and "suspended" state. This is to make it work for the code that runs inside the debugger itself (in the debugger coroutine), which may not be needed if you always run it from the client space.
You may try to expose isrunning and see if it works for you. I was thinking about a slightly different method, along the line of |
I see special logic here: https://github.com/pkulchenko/MobDebug/blob/master/src/mobdebug.lua#l515
I am not sure if there is any difference (current or other coroutine ) as I use luajit |
Yes; this logic makes it works the same way (in terms of coroutine debugging) for LuaJIT and other Lua interpreters.
There is as debug hook is going to be returned early for those coroutines that don't have debugging enabled (even under LuaJIT). |
Perhaps we need somehow to differ between "off for all coroutines" and "not connected"? |
So, it seems like we'd need 4 states: connected, connected and off everywhere, connected and on, connected and on elsewhere. You can probably check the second one by just doing |
You mean that when "connected and off everywhere" |
Need mobdebug method to get current status:
Discussed here: http://forum.farmanager.com/viewtopic.php?p=116950#p116950
The text was updated successfully, but these errors were encountered: