Context state change

Started by
3 comments, last by saejox 11 years, 5 months ago
Hi,

I'm currently writing a remote debugger, which i plan to share with you soon.
I have peculiar problem,

during debug if application unprepares a context but do not release it, there is no easy way for the debugger to know if context state is changed.

like this:
script runs
client say stop at line 10 at section x
debugger stops context on line 10.
steps out till function scope end.
application Unprepares function
debugger is not aware of the change it still thinks its in debugging state.
never inform application that debugging is finished, and ignore all other line callbacks because it is already debugging.

i currently actively check if debugged context is unprepared in one of the threads.
which is wasting cpu cycles. that thread would normally be waiting for debug commands to arrive and wake to process them.

i considered these but good not enough,
- depend on application to inform when context is unprepared. This error prone and much greater work needed for debugger integration.
- Check state change when debugger become wakes up again. This happens when client send debug information, or a new lineback. This would cause awkward pause when a function execution is complete.

did you face a similar problem?
what was your solution?

Thank you.
Advertisement
I haven't considered this situation before, but I can certainly see how it complicates things.

I believe an acceptable solution would be to have the context make a final LineCallback when the execution finishes, i.e. just before asIScriptContext::Execute() returns to the application. This would allow the debugger to see that the execution completed and disconnect itself.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game


I haven't considered this situation before, but I can certainly see how it complicates things.

I believe an acceptable solution would be to have the context make a final LineCallback when the execution finishes, i.e. just before asIScriptContext::Execute() returns to the application. This would allow the debugger to see that the execution completed and disconnect itself.


yes this would be great. would solve this instantly :)

another solution would be a context state change callback.
i had need of a such thing before for my concurrent execution pool, but switched to a proper multithreaded solution and forgot about it.
I've added the extra call to the LineCallback in revision 1446.

This callback is done after the context's state is updated, but before the Execute() method returns. The line callback can thus differ between this call and the ordinary line callbacks by checking the context's state, e.g. if ctx->GetState() returns asEXECUTION_ACTIVE, then it is an ordinary line callback, otherwise the returned state is what will be returned to the application.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

thank you. works great.
cpu usage is now zero when debugger is idle.

This topic is closed to new replies.

Advertisement