• Advertisement
Sign in to follow this  

Context state change

This topic is 1910 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. Edited by saejox

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote name='Andreas Jonsson' timestamp='1351008945' post='4993125']
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.
[/quote]

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement