[Gambas-user] Gambas3 Debugger: Data Breakpoint

John Anderson johna at starflightinc.com
Sun May 23 05:12:45 CEST 2021

EXACTLY.  Simple watching of a memory address is all I need - and break 
execution when the value it points to changes.  In all the times I've 
needed it I need something simple like break when a Boolean changes 
state, or when a public integer changes value.  Or maybe when a simple 
condition test is met.  It doesn't get more complicated than sometimes 
the "expression" we want to monitor is simple like "Break when (Xval < 
0)" or "Break when (XVal > 10)" .  It's not something you need every 
day, but on a large project it can be a lifesaver at troubleshooting 
time.  I think a couple times I had to monitor two values and break when 
either one changed or met a simple condition test.

In all cases where I've needed it it was to monitor a public variable, 
and break either when it changed...or say when the value went under or 
over range for instance.  It doesn't have to slow the system down much.

I've been using this feature for decades on VS, Qt etc, and where a Data 
Breakkpoint helps a lot in a large project is:

Where you need to monitor a public variable - typically just a Boolen or 
integer.  It is used in about 180 places throughout code, and the 
problem you're looking for is when it changes value in an unexpected 
way.  When did the value change and in what section of code, and what 
set of events lead to that condition.  There are many places where the 
change could have occurred depending on what's going on with the 
physical equipment we're running in the real world.

OR When you're debugging an issue where the public variable changes 
because it was sent by reference to a code class that you didn't write, 
and the variable gets referenced by another name inside that class.

OR when you have to call a C libray with the public variable sent as 
reference, and the C library unexpectedly changes the value.  At least 
we'd know the monitored value was changed when the C-function call returns.

And so on.  There are lots of places a feature like this comes in handy.

It would be very helpful if some sort of Data Breakpoint feature like 
this could be added to the Gambas debugger at some point.  You don't 
want it evaluating complex expressions - for sure that would be a slow down.


   We use a Data Breakpoint often in large code

On 5/22/2021 12:37 PM, Benoît Minisini wrote:
>> Le 22/05/2021 à 21:10, John Anderson a écrit :
>>> For instance in Gambas IDE: Setup a watch on public variable Xval , 
>>> and then tell the system we want to halt whenever Xval changes.
> Watching a public variable would easier, as the memory address of 
> static values and object contents never change during the program 
> execution.

More information about the User mailing list