Page 1 of 1
debugger watchpoints - how?
Posted: Tue Sep 19, 2017 3:59 pm
by bluebird
Dear Mentors
I frequently use the debugger breakpoint, evaluate etc, but I have not figured out how to use watchpoint or tracepoint.
How do you set up a list of points to watch?
Secondly, the DOC file saves that you can change the values of variables while running degug. Kindly explain how.
SIncere thanks
Re: debugger watchpoints - how?
Posted: Tue Sep 19, 2017 4:59 pm
by mol
You can assign new value in this way
YourVariable:=NewValue
Re: debugger watchpoints - how?
Posted: Tue Sep 19, 2017 8:18 pm
by esgici
bluebird wrote: ↑Tue Sep 19, 2017 3:59 pm
Dear Mentors
I frequently use the debugger breakpoint, evaluate etc, but I have not figured out how to use watchpoint or tracepoint.
How do you set up a list of points to watch?
Secondly, the DOC file saves that you can change the values of variables while running degug. Kindly explain how.
SIncere thanks
My best tracing points of watch tool is MsgDebug() function
Saving changed values of variables to a file (not .doc but .txt file) is something like this:
Before beginning of (for example) traversing records of data file(s)
SET ALTERNATE TO <my trace file>
SET ALTERNATE ON
inside of loop :
? <myVariable>
after loop:
SET ALTERNATE TO
SET ALTERNATE OFF
That is all for me
Happy HMG'ing
Re: debugger watchpoints - how?
Posted: Tue Oct 03, 2017 4:05 am
by bluebird
Thanks for the reply Mr. Esqici
Still, i would like to know how to use the debug utility
Re: debugger watchpoints - how?
Posted: Tue Oct 03, 2017 6:05 am
by Rathinagiri
My sample test code: main.prg
Code: Select all
#include <hmg.ch>
Function Main
public nVar1 := 0
define window main at 0, 0 width 400 height 300 main
define button count
row 10
col 10
caption 'Click me!'
action clicked()
end button
end window
main.center
main.activate
Return
function clicked
for i := 1 to 100
next i
nVar1 := 1000
msginfo( 'Counting over' )
return nil
in debug.hbp
Open IDE and open debug.hpb project.
Click on Debugger icon in IDE as shown below:
- Clipboard01.jpg (38.3 KiB) Viewed 2365 times
As the debugger is opened, you can see many options. Find Watch Point and click that icon as below:
- Clipboard02.jpg (61.54 KiB) Viewed 2365 times
In the watch expression textbox, enter the name of the variable you want to watch as the program runs. (for example I have added nVar1 public variable)
- Clipboard03.jpg (70.72 KiB) Viewed 2365 times
Now, adjust the watch monitor grid column sizes to show all the columns as shown in the figure below. You can see that as of now nVar1 is undefined and the value is NIL.
- Clipboard04.jpg (54.27 KiB) Viewed 2365 times
Now start the program execution in Animate mode as shown the figure below:
- Clipboard05.jpg (47.06 KiB) Viewed 2365 times
You can see that the nVar1 value is now changed to 0 (which is initialized in line no. 4 Now the program expects the user to click the button. Now click the button.
- Clipboard06.jpg (60.6 KiB) Viewed 2365 times
You can also see that when the counting is over, the value of nVar1 is changed to 1000.
- Clipboard07.jpg (49.03 KiB) Viewed 2365 times
I hope this explains how to use watchpoints in Debugger.
Let us thank Dr. Claudio for giving this wonderful tool!