Page 1 of 2 12>
Topic Options
#64823 - 2002-04-24 05:27 PM Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Is it possible to step through a UDF in debug mode? Everytime I step through with debug, it runs the UDF but does not show the steps.
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64824 - 2002-04-24 05:35 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I just tried it with 4.02 and 4.10 and it seems to work ok (for me).
Top
#64825 - 2002-04-24 05:50 PM Re: Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
OK, so take the follwing Code

code:
 

$value = "Compaq"
$Where = "Manufacturer"

$RC = Checkini($value,$where)
? $RC

exit

Function CHECKINI($VALUE,$WHERE)
$IniFile='$Server16 + "auditlog\Cinfo.INI"'
; $IniFile=substr('%WINDIR%',1,2)+'\Cinfo.INI'
$INI = ReadProfileString($inifile,@wksta,"$where")
Select
Case (@ERROR <> 0) AND ($Value <> " ")
WriteProfileString("$Inifile",@wksta,"$WHERE","$value")
$CHECKini = $VALUE
Case (@ERROR = 0) AND ($REG <= $VALUE)
WriteProfileString("$Inifile",@wksta,"$WHERE","$value")
$CHECKini = $VALUE
Case (@ERROR = 0) AND ($REG > $VALUE)
$CHECKini = $INI
Case 1
$Checkini = $Value
EndSelect
Return
EndFunction

When run in debug, Can you see which case it chooses?
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64826 - 2002-04-24 06:10 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Will,

Yeah, debug seems to be a little screwed with select/endselects in UDFs. Seems that kixtart first jumps over any cases prior to the case that is true, then display the next case, then jumps to the bottom. Heres a sample script where you can change $var to step through the scenarios:

break on

$var = 2

$new = Echo($var)

?"newvar=" $new

exit 1

function Echo($var)

 select

  case $var = 1 $Echo = 1
  case $var = 2 $Echo = 2
  case $var = 3 $Echo = 3
  case 1 $Echo = 0

 endselect

endfunction


I think this is a problem eh ?

-Shawn

Top
#64827 - 2002-04-24 07:55 PM Re: Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
My biggest problem is that when it hits the call for the function, It runs the function. It does not let you see each individual step in the function that it is performing.
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64828 - 2002-04-24 08:37 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Will

Thats really weird, I see the steps being executed. Can anybody verify this behavior ? Im running 4.10beta

-Shawn

Top
#64829 - 2002-04-26 12:20 AM Re: Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Shawn,
I went out and downloaded the beta1 version of 4.10 and it still did not let me step through the functions.
I am running windows 2000 with SP2 and all the fixes up to date.

I just tested it on my Win NT server and it still did not let me step through the functions.

My next step is to test it on the XP system I just installed.

[ 25 April 2002, 14:23: Message edited by: Will Hetrick ]
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64830 - 2002-04-25 02:08 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Is there anybody out there that can triple check this behavior ? Im running Windows XP. Here's a copy-paste log of what I see on my system. It aint perfect but it does enter the UDF:

C:\>kix32 test /d

break on
$var = 2
$new = Echo($var)
select
$Echo = 2
case $var = 3 $Echo = 3
?"newvar=" $new
"newvar=" $new
$new
exit 1

-Shawn

Top
#64831 - 2002-04-25 02:33 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I just tried this simple script:

break on

$var = myfunc()

exit 1

function myfunc()

 dim $x,$y

 $x = 1 + 2

 $y = 2 + 3

endfunction


and got this in my blue debug bar:

break on
$var = myfunc()
dim $x,$y
$x = 1 + 2
$y = 2 + 3
exit 1


This is strange indeed.

-Shawn

[ 25 April 2002, 14:35: Message edited by: Shawn ]

Top
#64832 - 2002-04-25 02:38 PM Re: Debugging a UDF
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Shawn,
I'm wondering if maybe Will isn't CALLing the function from a separate file while your's is in-line.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64833 - 2002-04-25 02:43 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Good thought but I just tried it and it still steps through the UDF.

-Shawn

I just tried it on NT4sp6 and it works there too.

[ 25 April 2002, 14:47: Message edited by: Shawn ]

Top
#64834 - 2002-04-25 03:18 PM Re: Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Dooh! Ok, I feel about as stupid as anyone can feel. For some reason I have always used F10 to step through kix scripts. I have just read the manual(imagine that) and realized that F10 does skips the functions by design. I should have been using F8. That was the whole problem.

I am just going to crawl in a hole somewhere and hide for a while.

Thanks shawn for your help!
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64835 - 2002-04-25 03:36 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Will, don't sweat it - your stock is still rising. I was just stepping through the code with the ENTER key.

-Shawn

p.s. There's a manual that comes with Kixtart ?

[ 25 April 2002, 15:37: Message edited by: Shawn ]

Top
#64836 - 2002-04-25 03:38 PM Re: Debugging a UDF
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
rofl
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64837 - 2002-04-25 03:40 PM Re: Debugging a UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
roflmao
Top
#64838 - 2002-04-25 03:54 PM Re: Debugging a UDF
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
I guess there is a manual, Some woman handed me someting and told me to read it!
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#64839 - 2002-04-25 04:00 PM Re: Debugging a UDF
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We aren't using very much the built-in debugging facility. Too much
user input is necessary. Also it can be necessary to extend your
script with additional code.
We are using most of the time our debug option of kixstrip
tool. You can easily see which lines were executed and what the kix-
tart error status was.

Shawn's example:
code:
                                            CLS
COLOR C+/N
AT (1,1) " "
IF RedirectOutput("")
ENDIF
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script starting."
? "-"
? "-curdir: "+LCASE(@curdir)
? "-scriptdir: "+LCASE(@scriptdir)
IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0)
? "-scriptname: "+LCASE(@scriptname)
ENDIF
? "-startdir: "+LCASE(@startdir)
? "-"
? "-userid: "+LCASE(@userid)+"/"+LCASE(@wuserid)
? "-user priv: "+LCASE(@priv)
IF (instr("-4.xx-","-"+substr(@kix,1,2)+"xx-") <> 0)
? "-version: inwin="+@inwin+"/dos="+@dos"/productsuite="+@productsuite+"/producttype="+@producttype"/csd="+LTRIM(RTRIM(@csd))
ELSE
? "-version: inwin="+@inwin+"/dos="+@dos
ENDIF
? "-"
?"- start-"+@time+"- @error @serror "?

?"- 1-"+@time+"- @error @serror "? BREAK ON
?"- 2-"+@time+"- @error @serror "?
?"- 3-"+@time+"- @error @serror "? $var = 2
?"- 4-"+@time+"- @error @serror "?
?"- 5-"+@time+"- @error @serror "? $new = Echo($var)
?"- 6-"+@time+"- @error @serror "?
?"- 7-"+@time+"- @error @serror "? ?"newvar=" $new
?"- 8-"+@time+"- @error @serror "?
?"- 9-"+@time+"- @error @serror "? EXIT 1
?"- 10-"+@time+"- @error @serror "?
?"- 11-"+@time+"- @error @serror "? FUNCTION Echo($var)
?"- 12-"+@time+"- @error @serror "?
?"- 13-"+@time+"- @error @serror "? SELECT
?"- 14-"+@time+"- @error @serror "?
?"- 15-"+@time+"- @error @serror "? CASE
$var = 1 $echo = 1
?"- 16-"+@time+"- @error @serror "? CASE
$var = 2 $echo = 2
?"- 17-"+@time+"- @error @serror "? CASE
$var = 3 $echo = 3
?"- 18-"+@time+"- @error @serror "? CASE
1 $echo = 0
?"- 19-"+@time+"- @error @serror "?
?"- 20-"+@time+"- @error @serror "? ENDSELECT
?"- 21-"+@time+"- @error @serror "?
?"- 22-"+@time+"- @error @serror "? ENDFUNCTION
?"- 23-"+@time+"- @error @serror "?

?"- end-"+@time+"- @error @serror "?
? "-"
? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script ending."
? "-"
IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0)
? "-"+@cpu+" ("+@mhz+" Mhz, memory "+MemorySize()+" MB)"
ENDIF
? "-"
;($begin)
;
; wed 24-apr-2002 23:54:17 (kix 4.10 vs 3.04e)
;
;Informative KIXSTRIP: no errors found (input=23 output=23 skip=0).
;
;Informative KIXSTRIP: 2 block_structures found.
;Informative KIXSTRIP: 1 UDF found.
;Informative KIXSTRIP: no labels found.
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
;Informative KIXSTRIP: 1 BREAK
;Informative KIXSTRIP: 1 ENDFUNCTION
;Informative KIXSTRIP: 1 EXIT
;Informative KIXSTRIP: 1 FUNCTION
;
;($end)

The output will be:
code:
-wednesday 2002/04/24 23:54:57- kixtart 4.02/3.04e script starting.
-
-curdir: d:\
-scriptdir:
-startdir: c:\windows
-
-userid: MCA/MCA
-user priv: guest
-version: inwin=2/dos=4.0/productsuite=/producttype=Windows 95/csd=B
-
- start-23:54:57- 0 The operation completed successfully.

- 1-23:54:57- 0 The operation completed successfully.

- 2-23:54:57- 0 The operation completed successfully.

- 3-23:54:57- 0 The operation completed successfully.

- 4-23:54:57- 0 The operation completed successfully.

- 5-23:54:57- 0 The operation completed successfully.

- 12-23:54:57- 0 The operation completed successfully.

- 13-23:54:57- 0 The operation completed successfully.

- 17-23:54:57- 0 The operation completed successfully.

- 21-23:54:57- 0 The operation completed successfully.

- 22-23:54:57- 0 The operation completed successfully.

- 6-23:54:57- 0 The operation completed successfully.

- 7-23:54:58- 0 The operation completed successfully.

newvar=2
- 8-23:54:58- 0 The operation completed successfully.

- 9-23:54:58- 0 The operation completed successfully.

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#64840 - 2002-05-27 11:53 AM Re: Debugging a UDF
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Your question return the input about debugging only a part of it.
We will implement a simple way of active and deactive "kixstrip debugging mode".
greetings.

btw: related topics will be informed about upgrade, or you can get informed by your
membership to our site.
Select Mail - member of site tab from our main pages to become a member.

(TO_DO)

[ 27 May 2002, 12:19: Message edited by: MCA ]
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#64841 - 2002-07-07 02:45 AM Re: Debugging a UDF
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We have upgrade our kixstrip tool. It recognizes new directives
which makes it possible to debug only a selective part of your code.
For the complete update info see topic
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=001943
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#64842 - 2002-07-16 01:34 PM Re: Debugging a UDF
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
(TO_DO_completed)
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.122 seconds in which 0.074 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org