Setting a breakpoint if variable changes?

Everything else that doesn't fall into one of the other PB categories.
miskox
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Setting a breakpoint if variable changes?

Post by miskox »

Is it possible to set a breakpoint on a specific variable when it changes the value?

Thanks.
Saso
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Setting a breakpoint if variable changes?

Post by mk-soft »

Yes,

For example:
- Start debugger with 'CallDeugger'
- Goto menu Debugger and add 'Data Breakpoints'
--- Condition: var <> 0
- Continue

Code: Select all

Global i, var

CallDebugger

For i = 1 To 100
  If i = 10
    var = 1
  EndIf
Next

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
STARGÅTE
Addict
Addict
Posts: 2234
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Setting a breakpoint if variable changes?

Post by STARGÅTE »

:shock:
I've been using PureBasic since 2004, but I saw this feature for the first time today.
Good to know, thanks.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: Setting a breakpoint if variable changes?

Post by BarryG »

Another fantastic debugging feature is the Watchlist. This is a window that shows real-time updates of any variables that you nominate, so you can see them as they change without needing to use the Debug() command everywhere.
miskox
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Re: Setting a breakpoint if variable changes?

Post by miskox »

Thanks. I will try the 'call debug'.

Saso
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Setting a breakpoint if variable changes?

Post by mk-soft »

STARGÅTE wrote: Sun Oct 09, 2022 6:08 pm :shock:
I've been using PureBasic since 2004, but I saw this feature for the first time today.
Good to know, thanks.
I've been using Purbasic since 2005. I've seen it for a while, but I tried it for the first time. :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
miskox
Enthusiast
Enthusiast
Posts: 107
Joined: Sun Aug 27, 2017 7:37 pm
Location: Slovenia

Re: Setting a breakpoint if variable changes?

Post by miskox »

BarryG wrote: Sun Oct 09, 2022 10:22 pm Another fantastic debugging feature is the Watchlist. This is a window that shows real-time updates of any variables that you nominate, so you can see them as they change without needing to use the Debug() command everywhere.
I use Watchlist all the time. But in my case I would have to press F8/F11... to many times because I am not sure when change happens.

Thanks.
Saso
Post Reply