Debugging and 'go cd x of stack y'

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Fjord
Posts: 145
Joined: Sat Dec 06, 2008 6:18 pm

Debugging and 'go cd x of stack y'

Post by Fjord » Tue Jun 11, 2024 9:36 pm

Hi,
I'm trying to debug a handler that basically takes parameters 'cdName' and 'stackName'. It does a few controls and eventually if everything is OK, does

Code: Select all

go cd cdName of stack stackName
I'm trying to debug my app and whenever the debugger reaches that instruction the debugger dies and the Livecode goes back to the IDE. I tried setting breakpoints at different places before this instruction. I also tried setting a breakpoint after that instruction but it's never reached.
Is that normal?
(MacOS 11.7.10, LC 9.6.11)
--
François

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Debugging and 'go cd x of stack y'

Post by stam » Tue Jun 11, 2024 10:29 pm

Fjord wrote:
Tue Jun 11, 2024 9:36 pm
Hi,
I'm trying to debug a handler that basically takes parameters 'cdName' and 'stackName'. It does a few controls and eventually if everything is OK, does

Code: Select all

go cd cdName of stack stackName
I'm trying to debug my app and whenever the debugger reaches that instruction the debugger dies and the Livecode goes back to the IDE. I tried setting breakpoints at different places before this instruction. I also tried setting a breakpoint after that instruction but it's never reached.
Is that normal?
(MacOS 11.7.10, LC 9.6.11)
Not quite clear what you're after - from personal experience it's often helpful setting breakpoint in the first line of the handler (or the calling handler) and then stepping through line-by-line to see what's going on...

Alternatively, you should try a Try/Catch block?
You can look it up in the dictionary, but broadly it is of the form:

Code: Select all

try
   <code to try>
catch <errorVariable>
   <code to act on if the try code fails>
end try

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

Re: Debugging and 'go cd x of stack y'

Post by dunbarx » Tue Jun 11, 2024 11:01 pm

whenever the debugger reaches that instruction the debugger dies and the Livecode goes back to the IDE.
What? The debugger releases control midstream by itself? It stops, er, debugging and just exits back to the IDE? This should ONLY happen if you press CMD-Y or the "Stop debugging" button at the top of the SE (the blue square button).

I suppose you could pull the plug on your machine as well.

Are we sure the description of what is happening is correct?

Craig

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

Re: Debugging and 'go cd x of stack y'

Post by dunbarx » Tue Jun 11, 2024 11:03 pm

Rereading, and with a hint from Stam, how are you entering the debugger in the first place? With a breakpoint (either an explicit line of code or a red dot)?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

Re: Debugging and 'go cd x of stack y'

Post by richmond62 » Wed Jun 12, 2024 9:15 am

I suppose you could pull the plug on your machine as well.
Time to wag my finger at you: sarcasm: naughty person!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

Re: Debugging and 'go cd x of stack y'

Post by richmond62 » Wed Jun 12, 2024 9:30 am

I just knocked together a stack with 3 cards (erm: I recycled it from an earlier exercise) and gave each card the same dropDown menu:
-
SShot 2024-06-12 at 11.27.01.png
-
All rather difficult why that should crash anything.

Not helped by trying to find the debugger:
-
SShot 2024-06-12 at 11.32.01.png
-
Attachments
Cards 'n' Things.livecode.zip
Stack.
(942 Bytes) Downloaded 121 times

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

Re: Debugging and 'go cd x of stack y'

Post by dunbarx » Wed Jun 12, 2024 1:50 pm

Richmond.

What is the relevance of your stack?

The OP is struggling (I think) with peculiar debugger behavior.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

Re: Debugging and 'go cd x of stack y'

Post by richmond62 » Wed Jun 12, 2024 2:00 pm

What is the relevance of your stack?
Initially it was to look at moving to a card in a stack, as per the OP's script.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Debugging and 'go cd x of stack y'

Post by Klaus » Wed Jun 12, 2024 2:20 pm

Bonjour Francois,

can you please post the complete script?

Maybe there is something else going on, a simple "go cd xyz of stack zxy"
should not crash or something.

Best

Klaus

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

Re: Debugging and 'go cd x of stack y'

Post by jacque » Wed Jun 12, 2024 6:24 pm

We need to know the values of cdName and stackName.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

Re: Debugging and 'go cd x of stack y'

Post by richmond62 » Wed Jun 12, 2024 6:27 pm

We need to know the values of cdName and stackName
I would assume (dangerous business) that they are the names of cards in stacks that are currently open . . .

Although I wonder if stackName is the name of a stack other than the one in which the code resides whether that won't throw a 'bluey' as cards from another stack cannot be shown in the originating stack's window.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Debugging and 'go cd x of stack y'

Post by Klaus » Wed Jun 12, 2024 6:33 pm

But he did NOT write:

Code: Select all

go cd x of stack y in window of THIS stack

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

Re: Debugging and 'go cd x of stack y'

Post by dunbarx » Wed Jun 12, 2024 7:00 pm

Guys and gals.

How would any of that kick out a running debugger? The worst that could happen is that an error is thrown, and the debugger halts.

I am suspecting that the word "debugger" is not what we think it is. 8)

Craig

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Debugging and 'go cd x of stack y'

Post by SparkOut » Wed Jun 12, 2024 8:03 pm

Inconceivable!

Oh, um. Yes, very conceivable.

Can you

Code: Select all

answer "go cd" && cdName && "of stack" && stackname 
just before the actual "go" statement.

That will show what the command causing the crash looks like and we can go from there.

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

Re: Debugging and 'go cd x of stack y'

Post by jacque » Wed Jun 12, 2024 8:17 pm

dunbarx wrote:
Wed Jun 12, 2024 7:00 pm
Guys and gals.

How would any of that kick out a running debugger? The worst that could happen is that an error is thrown, and the debugger halts.

I am suspecting that the word "debugger" is not what we think it is. 8)
I think he means an error occurred that stops the debugger. The reason we need to know the values of the variables is because if he's using anything but the short name, an error will occur when LC tries to parse "stack stack thisStack" or "card card thisCd".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply