Page 1 of 1
Breakpoint affecting script execution?
Posted: Wed May 08, 2013 9:19 am
by david.silmanBUSrUeQ
Hi all, a slightly odd one
As a team we've started to notice that every now and again, we'll get an error, a nice repeatable error which is just a problem in the code we've written, but when using breakpoints to debug the code, the error no longer occurs, this is, as you can imagine, incredibly frustrating as it means we can't step through the code and see where and why it's going wrong, is there any reason for this behavior?
Thanks
David
(Problem noticed in livecode 5.5 all the way through to lc 6)
Re: Breakpoint affecting script execution?
Posted: Wed May 08, 2013 11:44 am
by lordmax
Hi
Obviously I don't know if it's the case but something similar happens to me working with ajax
sometimes the answer is not fast enough to exploit the data read later and this generates an error.
Obviously in debugging, given the slowness of the manual steps the ajax call ends before any calls to objects.
Re: Breakpoint affecting script execution?
Posted: Wed May 08, 2013 11:58 am
by david.silmanBUSrUeQ
I think it is the same, i get the impression that livecode tends to get ahead of itself slightly sometimes. It is an annoying problem
Re: Breakpoint affecting script execution?
Posted: Wed May 08, 2013 8:04 pm
by mwieder
Ouch! Yeah, I feel your pain there. You have a couple of options here.
The first is to place your problem code in a try/catch construct. My normal pattern for this is something like:
Code: Select all
try
... here's the original code
catch e
answer e
end try
That way you will get an answer dialog that tells you where the error occurred.
One thing that might help is that errors in system stacks are ignored by the debugger by default. This is in general a good thing since it keeps you out of endless loops from which there is no escape. But you can change this behavior temporarily by
Code: Select all
global gRevDevelopment
put true into gRevDevelopment
and then try debugging again.
Re: Breakpoint affecting script execution?
Posted: Thu May 09, 2013 8:30 am
by david.silmanBUSrUeQ
Ahh brilliant!
Thank you so much, next time I encounter this problem I will give those a try!
That'll be much faster than my usual method of putting breakpoints after the error and moving them ever closer to it to see where the error occurs (or rather, stops occuring)
##EDIT##
After getting another of those problems I was able to step through the system stacks and find the problem, that is so incredibly useful!
Thank you again!
Cheers
David
Re: Breakpoint affecting script execution?
Posted: Thu May 30, 2013 7:33 pm
by mwieder
@David-
If you can localize any problems in system stacks, please report them in detail to
support@runrev.com so that they can get logged and fixed.
You'll be doing all of us a favor. Thanks in advance.