Re: BREAKing into Euphoria
- Posted by Matt Lewis <matthewwalkerlewis at ??ail.com> Sep 12, 2007
- 2135 views
Pete Lomax wrote: > > Andy Drummond wrote: > > Yes, well, I see what you mean now. The control-C or control-Break keys do > > indeed break the program but there is no evidence that it ever reaches the > > code you sent. So ... not much further forward. > > What I get here, not every time though, is a partial/garbled trace window and > fatal exception, eg <a > href="http://palacebuilders.pwp.blueyonder.co.uk/break.gif">http://palacebuilders.pwp.blueyonder.co.uk/break.gif</a> > Nevermind, I'll email you privately if I get any further with this. Yes, the problem, as you previously sorta mentioned, is that windows creates a new thread and uses that thread to call the handler. It's probably fairly straightforward to manage this in a thread-safe way within the C-backend, but I don't see a nice way to do this in a purely Eu-based fashion. I think the way to go is to use trace(3) (was about to post it until I noticed that Rob beat me to it). As for having to put "with trace" everywhere: You'd have to do this regardless (the top of your main would work, unless you have any "without trace" statements elsewhere in your code. Otherwise, Euphoria doesn't generate the IL that drives the trace screen. trace(3) is clearly the way to go. Let it run for a while, and check out the file. It should be numbingly repetitive if you're really in an infinite loop. You may want/need to "without trace" some library routines to cut down on the noise. Even better, only enable tracing in routines that use while or for loops. You could probably make an automated tool to insert/remove the with/without statements, assuming you've got a lot of code/files to deal with. Matt