debug issue
debug issue
I have a logical variable (public) that is somehow changing value when it shouldn't. I have a break point at every place the variable can change value (thru VX20 2.0.338). I still can't tell when its changing. Thre's a
watch list' in VX, but I cant get variables into it.. and the variable view (view, debug window, variables) is always blank also. Under tools, debugger options I have all variabletypes clicked to show, but my Variable screen is different from thati n the help file (mine doesn't have the 'manipulation' section on it).
How can I get the variable values to display in the degug window to track their values? How can I get one or 2 into the watch window?
I tried using Roger's WTF... but that only shows the value AT THAT POINT. Is there a method in Express of watching the value as it chnges when I step thru the code?
as always.. thanks
watch list' in VX, but I cant get variables into it.. and the variable view (view, debug window, variables) is always blank also. Under tools, debugger options I have all variabletypes clicked to show, but my Variable screen is different from thati n the help file (mine doesn't have the 'manipulation' section on it).
How can I get the variable values to display in the degug window to track their values? How can I get one or 2 into the watch window?
I tried using Roger's WTF... but that only shows the value AT THAT POINT. Is there a method in Express of watching the value as it chnges when I step thru the code?
as always.. thanks
There are only 10 kinds of people - those who understand binary and those who don't
Re: debug issue
Hi, Bruce.
Move all accesses/assignments to the var(s) to a get/set-function which sets the value or returns it. Place your debug code there (use DC_CallStack). Do you work with XPF-files and "RESTORE FROM" / "SAVE TO"? Maybe you restore the value there.
Move all accesses/assignments to the var(s) to a get/set-function which sets the value or returns it. Place your debug code there (use DC_CallStack). Do you work with XPF-files and "RESTORE FROM" / "SAVE TO"? Maybe you restore the value there.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: debug issue
Tom -
That's what I was going to suggest, but I didn't know how many publics would be affected by this.
I'm working on updating a client application, written by another programmer, in which he used a large public array and accessed each value through a function named Publics(). At first, this was cumbersome code to look at but I find that it is much easier to debug because every public is Get or Set through this function.
I tend to use very few publics in my apps, so I don't usually need something like this, but it's a good programming idea.
Roger
That's what I was going to suggest, but I didn't know how many publics would be affected by this.
I'm working on updating a client application, written by another programmer, in which he used a large public array and accessed each value through a function named Publics(). At first, this was cumbersome code to look at but I find that it is much easier to debug because every public is Get or Set through this function.
I tend to use very few publics in my apps, so I don't usually need something like this, but it's a good programming idea.
Roger
The eXpress train is coming - and it has more cars.
Re: debug issue
this "Technique" is used by "Summer 93"*** to get rid of PUBLIC Variabel.
(*** there was realy a Product with this Name )
you can put all Function into one PRG and use #xtranslate with a "big" Array
you can use same "Technique in a Class ( STATIC -> Class VAR ) when have multiple MDI-Client Windows , each have its own "Stack".
(*** there was realy a Product with this Name )
Code: Select all
FUNCTION SP_Duration(nValue)
IF PCOUNT() > 0
nDuration := nValue
ENDIF
RETURN (nDuration)
Code: Select all
#xtranslate nDuration => Stack\[SP, 1]
...
#xtranslate cHelloWorld => Stack\[SP, 100]
STATIC Stack := {}
STATIC SP := 0
FUNCTION _STACKINIT()
AADD(Stack,ARRAY(100))
SP ++
RETURN (SP)
FUNCTION _STACKEXIT(nThread)
LOCAL iMax
ADEL(Stack,nThread)
DO WHILE .T.
iMax := LEN(Stack)
IF iMax = 0
EXIT
ELSEIF Stack[iMax] = NIL
ASIZE(Stack,LEN(Stack) - 1)
ELSE
EXIT
ENDIF
ENDDO
SP := LEN(Stack)
RETURN (SP)
greetings by OHR
Jimmy
Jimmy
Re: debug issue
Jimmy -
I have used that technique many times in the past too, but it doesn't solve the problem of triggering a debug event when writing to the variable.
Roger
I have used that technique many times in the past too, but it doesn't solve the problem of triggering a debug event when writing to the variable.
Roger
The eXpress train is coming - and it has more cars.
Re: debug issue
hi,
Code: Select all
nDuration := 100
FindExpression ( {|| nDuration = 0} )
FUNCTION FindExpression (bBlock)
oThread := Thread():new()
oThread:start("Sp_StopHere",bBlock)
oThread:setInterval(100)
RETURN
FUNCTION Sp_StopHere(bBlock)
IF EVAL(bBlock)
? PROCENAME(2)
? PROCLINE(2)
WAIT
ENDIF
RETURN
greetings by OHR
Jimmy
Jimmy
Re: debug issue
thanks guys.. question: what's the problem with public variables?
There are only 10 kinds of people - those who understand binary and those who don't
Re: debug issue
Advantages:what's the problem with public variables?
1. PUBLICs are visible everywhere, even in different threads.
2. PUBLICs can be initialized in a function, they get visible "above".
3. PUBLICs can be stored to/restored from a XPF-file (as PRIVATEs).
4. PUBLICs can be changed everywhere, changed values are visible instantly - everywhere.
Disadvantages:
Same as above.
If you run the same code in two threads and change a public var in one, it's changed for the other thread aswell. This may happen just in the midth of code which started with a different value of the var. Imagine a var switching an option. Now code runs for this option while this option is changed. Your app may crash. The results of the code may be wrong. Or, or, or.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: debug issue
i do not think Xbase++ have "spezial" Problem with it. ( see what Tom say )BruceN wrote:question: what's the problem with public variables?
Cl*pper DGROUP is limited to 64Kb ( not MB ) which PUBLIC use, so when you Application growe you might got into Trouble with DGROUP.
greetings by OHR
Jimmy
Jimmy
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: debug issue
I utilize a small number of public variables to house configuration parameters that are loaded at program startup and not changed by programs. It was due to the visability desire as the program was created originally in summer87 this way. I could use a get/set function also for the same purpose but never went fully that way.
So I don't have problems with things being inadvertently changed.
So I don't have problems with things being inadvertently changed.