Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Context state change


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 saejox   Members   -  Reputation: 714

Like
0Likes
Like

Posted 23 October 2012 - 08:02 AM

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, 23 October 2012 - 09:42 AM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3309

Like
0Likes
Like

Posted 23 October 2012 - 10:15 AM

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

#3 saejox   Members   -  Reputation: 714

Like
0Likes
Like

Posted 23 October 2012 - 10:34 AM

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.

#4 Andreas Jonsson   Moderators   -  Reputation: 3309

Like
1Likes
Like

Posted 25 October 2012 - 07:26 PM

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

#5 saejox   Members   -  Reputation: 714

Like
0Likes
Like

Posted 26 October 2012 - 05:36 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS