Debugger/stepping back thru handler/variable calls/values per run
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Debugger/stepping back thru handler/variable calls/values per run
SuperCard's debugger allowed us to "step back" in debugging mode through the list of handlers called; variables set.
Does LiveCode, as well ?
Does LiveCode, as well ?
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Debugger/stepping back thru handler/variable calls/values per run
Hmmm... been a while since I've used the built-in debugger, but I think it does.
PowerDebug, of course, allows you to step back through the execution contexts and see the variables.
I think there's a control in the built-in debugger to do that as well, but someone else will have to chime in with a definitive answer.
PowerDebug, of course, allows you to step back through the execution contexts and see the variables.
I think there's a control in the built-in debugger to do that as well, but someone else will have to chime in with a definitive answer.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Debugger/stepping back thru handler/variable calls/values per run
Hi.
I never heard of such a thing. Anyone?
Craig
I never heard of such a thing. Anyone?
Craig
Re: Debugger/stepping back thru handler/variable calls/values per run
When debugging, directly below the title bar of the script editor window, the seventh control from the left is the execution context menu. The script field and the variables pane respect the menu selection.
But actually stepping backwards, as far as I know, is only a dream, albeit a very pleasant one.
-- Dick
Re: Debugger/stepping back thru handler/variable calls/values per run
I think that’s exactly what’s being asked for judging by the OP’s description. I, too, had missed that drop down menu for the longest time that lets you step up into calling handlers. Extremely useful and something one expects from a “proper” debugger.
I don’t think I’ve ever heard of a debugger that rewinds the code backwards, which is the other interpretation of the OP…
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Debugger/stepping back thru handler/variable calls/values per run
Stam.
I bet it is the rewinding that is asked for.
I also have never used that menu.
Craig
I bet it is the rewinding that is asked for.
I also have never used that menu.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7266
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Debugger/stepping back thru handler/variable calls/values per run
I use it a lot, it's very handy to see where a variable gets set or where the call came from.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Debugger/stepping back thru handler/variable calls/values per run
Thanks, Dick. I thought I remembered it being in there somewhere.
I think I've only seen actual rewinding in one experimental java demonstration.
I did build it into PowerDebug some time back, but it's *so* intrusive to real-time code execution that I never released it - you end up with a virtual breakpoint at every line of code, taking a snapshot of the execution point and all the variables indexed by the time, and moving on to the next line. That allows you to work backwards through the accumulated snapshots, but the pain of accumulating the data way offset the advantage of being able to move back through the code execution.
I think I've only seen actual rewinding in one experimental java demonstration.
I did build it into PowerDebug some time back, but it's *so* intrusive to real-time code execution that I never released it - you end up with a virtual breakpoint at every line of code, taking a snapshot of the execution point and all the variables indexed by the time, and moving on to the next line. That allows you to work backwards through the accumulated snapshots, but the pain of accumulating the data way offset the advantage of being able to move back through the code execution.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Debugger/stepping back thru handler/variable calls/values per run
You are correct, was looking for rewind similar to what SuperCard’s debugger can do.
I assume the SC team considered the variable grid as a table, which was exported to a temporary recallable file each time any value was changed or handler passed.
Maybe these temp files were named using the ticks or something, and clicking the forward/backward arrow advanced/reversed through a directory list.
There was an “exit to script” button that would then trash the temp files perhaps.
I assume the SC team considered the variable grid as a table, which was exported to a temporary recallable file each time any value was changed or handler passed.
Maybe these temp files were named using the ticks or something, and clicking the forward/backward arrow advanced/reversed through a directory list.
There was an “exit to script” button that would then trash the temp files perhaps.
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Debugger/stepping back thru handler/variable calls/values per run
Don't know.I assume the SC team considered the variable grid as a table, which was exported to a temporary recallable file each time any value was changed or handler passed.
In LC as long as you're in active debug mode you can examine the variables at any point in the current context by
set the debugContext to <index into the executionContexts>
debugDo "get the variables"
The variables will be comma-delimited, with one type per line.
Then you can query for an individual variable value
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Debugger/stepping back thru handler/variable calls/values per run
Mark.
"deBugDo" sounds like a hair product. If I have:
and execute debugDo "temp", I get nothing. How does one use this?
And "debugContext" is yet one more of those undocumented words?
Craig
"deBugDo" sounds like a hair product. If I have:
Code: Select all
on mouseUp
put random(99) into temp
breakpoint
end mouseUp
And "debugContext" is yet one more of those undocumented words?
Craig
Re: Debugger/stepping back thru handler/variable calls/values per run
With an "internal" that stores a complete copy of the user's variables tree, and another that reinstates it, debugging our algorithms could be simpler and faster. Is that right, Mark?mwieder wrote: ↑Tue Jun 20, 2023 9:55 pmIn LC as long as you're in active debug mode you can examine the variables at any point in the current context by
set the debugContext to <index into the executionContexts>
debugDo "get the variables"
The variables will be comma-delimited, with one type per line.
Then you can query for an individual variable value
-- Dick
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Debugger/stepping back thru handler/variable calls/values per run
Possibly. It would take serious instrumentation of the execution machine. Changing the context is fast, but getting the variables list and getting the individual variable values requires runtime string evaluation. There's probably a way around that, but I'm not gonna hold my breath waiting for the team to implement it. Maybe monkeypatching the engine could work, but that's serious code injection.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Debugger/stepping back thru handler/variable calls/values per run
Probably safest to assume that many here don't know what the SuperCard debugger does
Regardless, if I understood you correctly then you would also need an undo mechanism for the interface (to 'rewind' the outward effect of code as you would step backwards).
That would be a dealbreaker in the current IDE, as undo in the graphical interface is extremely limited (if you manage to delete a control, there is no undo from that and in general where undo does work in the interface it's only 1 step deep - as opposed to the script editor which has unlimited undo).
So it would take more than just creating steroid-infused debugger, you'd need to upgrade the IDE as well.
I'm gonna say that isn't going to happen any time soon.
Will LC consider implementing this? Who's to say - but there's the fact that other than SC, pretty much no other IDE offers this - meaning that the traditional step into/step over techniques work for pretty much everyone. If you have one handler calling anther then at any breakpoint you can change contexts from one handler to another with the dropdown menu at the top and instantly examine the variables used in each handler, either by hovering over the variable name in the script editor, or in the variable list.
I'm not sure I understand the real value of stepping backwards is personally, although I get that if you're used to a particular feature, you may miss it when it's not there...
Short answer: No you can't do this in LC and seems extremely unlikely this will be possible in the near future.
But there's nothing to stop you submitting an enhancement request with the team at https://quality.livecode.com, you never know...
regards,
S.
Re: Debugger/stepping back thru handler/variable calls/values per run
Thank-you for responding, S.
The LC debugger does have abilities SC debugger lacks, such as the ability to keep variable windows open through various runs of a given handler.
And its ability to manage simultaneous scripts is fantastic.
The stepping “into” and “over” seems identical to the SC debugger.
You’re correct that my question referred to applicability of SC habit.
My knowledge level of LC is still quite low; much to learn about various debuggers.
I appreciate your concise response.
The LC debugger does have abilities SC debugger lacks, such as the ability to keep variable windows open through various runs of a given handler.
And its ability to manage simultaneous scripts is fantastic.
The stepping “into” and “over” seems identical to the SC debugger.
You’re correct that my question referred to applicability of SC habit.
My knowledge level of LC is still quite low; much to learn about various debuggers.
I appreciate your concise response.