error window detail

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
SteveTX
Posts: 170
Joined: Sun Jan 17, 2010 9:00 pm

error window detail

Post by SteveTX » Mon Jul 15, 2013 4:18 am

I would like more detail from the error window. It provides insufficient information to determine race condition errors, therefore I need the option of seeing exactly what millisecond / epoch time that an error actually happens. I would also like it to include a message path trace longer than just the object/variable that caused the error so if I have many of the same functions being called quickly, I know which path caused it.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: error window detail

Post by dunbarx » Mon Jul 15, 2013 5:18 am

I am intrigued by your suggestion that a more precise indication of the timing of an error might be helpful. In my experience, it is the sequence of actions, not their timing, that matters.

I have seen the time stamps in the message watcher, but never paid any attention to them. How do you use them to help you find errors?

The best thing about the error pane in the script editor is the ability to double click on an error, and unless the whole offending line is the culprit, the portion of that line that needs looking into is hilited. Do you know about this? But again, it is a stepwise tool, not a timing one.

Craig Newman

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: error window detail

Post by jacque » Mon Jul 15, 2013 5:58 pm

You can trace the calling handlers by using the "Execution contexts" popdown button at the top left of the script editor window, next to the step buttons. Handler calls are listed in reverse order with the most recent at the top. Choosing any handler will take you to that part of the script and update the variables to show what they were when the handler was executing.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: error window detail

Post by dunbarx » Mon Jul 15, 2013 7:26 pm

Jacque.

Never knew this.

But I am missing how it works. If I have a handler that calls another, and step through, only the current handler has it variables listed:

Code: Select all

on mouseup
  put 66 into var
  goSomewhere
end mouseup

on goSomewhere
   put 77 into anotherVar
end goSomewhere
Breakpoint at first line of "mouseUp"

Reading your post, I thought that I could, while stepping through the "goSomewhere" handler, click on the "mouseUp" handler in that popup and see what the value of "var" is. I cannot. It hilites the line in the mouseUp handler, but does not reload the variables in that handler.

And setting these as script local variables shows them all anyway regardless of what I do with that popup.

Craig

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: error window detail

Post by mwieder » Mon Jul 15, 2013 7:54 pm

It hilites the line in the mouseUp handler, but does not reload the variables in that handler.
Quite correct.
I should, of course, point out that PowerDebug does indeed do the right thing, showing variables in context.
http://www.ahsoftware.net/PowerTools/BuyPowerDebug.irev

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: error window detail

Post by FourthWorld » Mon Jul 15, 2013 8:22 pm

Race conditions are pretty rare in LC, unless you're using timers.

Can you post the relevant code?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: error window detail

Post by mwieder » Mon Jul 15, 2013 9:49 pm

Richard-

sockets are also a good place to get into race conditions. Anywhere you have asynchronous events firing, they can get out of order.

SteveTX
Posts: 170
Joined: Sun Jan 17, 2010 9:00 pm

Re: error window detail

Post by SteveTX » Mon Jul 15, 2013 11:39 pm

What I'm doing is simple but convoluted. I am dynamically creating the UI on the fly, and I've got a command that creates button objects, and then calls another command, updateButtonScript to set the script of the button.

Normally this violated self-referential calls for set script. The fist itteration to defeat this was to send updateButtonScript in x milliseconds, which works about 70% of the time with increasingly large x values. While that solution works on desktop, those increasingly large delays to waits are not acceptable for a mobile environment. So instead i pivoted to another card to change the context, so updateButtonScript dispatched to command Pivot on another card, which then sets the button script on the prior card. This works quickly and eliminated the need to wait, but probably isn't the best method.

Now you're executing so fast that you get race conditions if the button even exists at that point, so we add 'wait until there is a button theButton of card myCard' to the Pivot command and we get much higher success rates. Now, add multiple assignments of buttons within a short time and you get 4 small windows for race conditions competing against each other, extending the parent handler's open message path time, and creating more updateButtonScript events to pivot off of.

Thus the need for very specific timing details so I know exactly when things are firing off and colliding. At least until I figure out how to completely break the message context...

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: error window detail

Post by mwieder » Tue Jul 16, 2013 12:16 am

What I'm doing is simple but convoluted.
Nothing simple about this at all :-)

Rather than "wait until there is a button myButton of card myCard", how about something like

Code: Select all

on setTheButtonScript parameters
  if there is no button myButton of card myCard then
    send "setTheButtonScript parameters" to me in 10 milliseconds
  end if
end setTheButtonScript
That way there's no blocking while it's waiting for the button to appear, and you get a chance to handle other pending messages in sort of a round-robin style.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: error window detail

Post by mwieder » Tue Jul 16, 2013 12:23 am

...and I thought the milliseconds reporting was a good idea, so I just added it to PowerDebug's error reporter.

Post Reply