Setting conditional breakpoints

J. Landman Gay jacque at hyperactivesw.com
Mon Jun 24 15:42:42 EDT 2019


I doubt you're thick, Lagi. :) As I mentioned before, I'm having a lot 
of trouble with breakpoints lately. Also, there's a difference between a 
breakpoint and a watch, and I rarely use watches because they aren't 
universally applicable. I do use conditional breakpoints though.

A watch is supposed to catch any instance where a specified variable 
changes its value. My experiments were several years ago, but back then 
I found that only global variables honored watches. I guess that makes 
sense, since you can't trap a variable that isn't in memory already. I 
don't use watch variables any more because I don't use globals much. And 
even back then, watches weren't always reliable.

For normal breakpoints, I don't use the breakpoints pane in the editor, 
I usually set them directly in the script. Set a red dot at the place 
where you want to break, right-click the dot, and choose Edit. In the 
dialog that appears, type the condition that needs to be met. The 
condition needs to include a variable that occurs in the handler you're 
debugging.

An example:

on foo pVar
   put the number of items in pVar into tNum
   switch tNum
     case 1
       doThing 1
       break
     case 2
       doThing 2
       break
     case 3
       doThing 3
       break
   end switch
end foo

I can now set a breakpoint at the "switch tNum" line with a condition:
   tNum = 2
and the breakpoint will only fire if that condition is met.

There used to be a problem deleting breakpoints from the pane in the 
editor window, but that was fixed a while ago. Maybe it has recurred. I 
don't use that, I just click on the dot in the script to remove it and 
that has always worked. If you're using an older version of LC, you may 
have hit that bug though.

On 6/24/19 5:49 AM, Lagi Pittas via use-livecode wrote:
> Hi Jacque,
> 
> It never worked before and I couldn't get it to work today. I can't be that
> thick  can I?
> If the "incantation" means I can't get it work (especially the delete - the
> breakpoints i set would not remove however I clicked) easily
> then I would presume there are some people as dumb as me who won't be able
> to do it.
> 
> I spent over half an hour trying to get a watch/breakpoint working - do you
> tie the watch to the breakpoint if so how - Tried
> 
> Can you give me a recipe "for dummies"
> 
> "Don't make me think" -  Steve Krug
> 
> "Show me the Banana" - "The BIg Red Fez" - Seth Godin
> 
> "The best way to motivate the monkey, of course, is to use a banana.
>   Whenever the monkey walks into a new situation, all it wants to know is,
> “Where’s the banana?”
>   If the banana isn’t easy to see, easy to get and obvious, the monkey is
> going to lose interest.
>   But, if you can make it clear to the monkey what’s in it for him, odds are
> he’ll do what you want. "
> 
> Thanks
> 
> Lagi
> 
> On Sat, 22 Jun 2019 at 00:48, J. Landman Gay via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> Set a breakpoint, right click it, choose condition, and fill out the
>> dialog. That's how I usually do it.
>> --
>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>> HyperActive Software | http://www.hyperactivesw.com
>> On June 21, 2019 5:34:30 PM Bob Sneidar via use-livecode
>> <use-livecode at lists.runrev.com> wrote:
>>
>>> In the breakpoints tab of the script editor, if you right click the
>> lower
>>> pane, you can create conditional breakpoints. For instance if the value
>> of
>>> a variable is something. I have never gotten them to work, and I find I
>> am
>>> needing this more and more.
>>>
>>> Bob S
>>>
>>>
>>>> On Jun 21, 2019, at 15:26 , dunbarx--- via use-livecode
>>>> <use-livecode at lists.runrev.com> wrote:
>>>>
>>>> Not sure what you could mean.
>>>> on mouseUp  if the mouseLoc is within the rect of btn 3 then
>> breakPoint
>>>> if the visible  of btn 3 then breakPoint   if the...
>>>>
>>>>
>>>> Surely I am missing this.
>>>> Craig
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com





More information about the Use-livecode mailing list