Jump to content
Sign in to follow this  
Oldschool

Debugging a compiled script...

Recommended Posts

Oldschool

Alright, so I got a script that I debuged and tested prior to compilation, and it ran just fine for hours.

Now I went and compiled the thing with obfuscation, and now about 1 hour into it it crashes due to stack overflow.

What shoud my game plan be when trying to rid of this error. How do I find out what is causing besides making small mods and recompiling and running a million times over??

Share this post


Link to post
Share on other sites
Fossil Rock

Alright, so I got a script that I debuged and tested prior to compilation, and it ran just fine for hours.

Now I went and compiled the thing with obfuscation, and now about 1 hour into it it crashes due to stack overflow.

What shoud my game plan be when trying to rid of this error. How do I find out what is causing besides making small mods and recompiling and running a million times over??

The first thing I would do is compile without obfuscation and see if you get the same problem.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites
Oldschool

The thing that bugs is this:

My script does the same thing every minute...

How/why could it crash from stack overflow an hour + into it??

Theoretically??

Share this post


Link to post
Share on other sites
Jos

The thing that bugs is this:

My script does the same thing every minute...

How/why could it crash from stack overflow an hour + into it??

Theoretically??

is this an recursion issue? What is the exact error message you get ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Oldschool

Error --> Recursion level exceeded -->Autoit exited to prevent stack overflow

Edited by Oldschool

Share this post


Link to post
Share on other sites
Jos

Error --> Recusion level exceeded -->Autoit exited to prevent stack overflow

that means your script has an logic error and functions are calling eachother without them ever returning ..

You need to show your script to be able to help you but the basic issue is this:

; This code will cause a recursion error 
UDF1()

Func UDF1()
    Sleep(10)
; Do things
    UDF2()
; Do other things
EndFunc

Func UDF2()
; Do things
    UDF1()
EndFunc

Which should be:

Func UDF1()
    Sleep(10)
; Do things
    UDF2()
; Do other things
EndFunc

Func UDF2()
; Do things
    Return
EndFunc
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Oldschool

that means your script has an logic error and functions are calling eachother without them ever returning ..

You need to show your script to be able to help you but the basic issue is this:

It's 30 pages long :P)

I thought that might be the problem. I'll be able to fix it now...

Thanks Jos

Edited by Oldschool

Share this post


Link to post
Share on other sites
Oldschool

Hey what about this syntax

UDF1()
Func UDF1()
While $var < 10
; do some stuff
      UDF2()
WEnd
         While $var1 < 20
        ; do some stuff
            UDF3()
          WEnd
While $var2 > 5
; do some stuff
      UDF4()
WEnd

UDF1()
EndFunc
Edited by Oldschool

Share this post


Link to post
Share on other sites
Jos

Now do me a favor and reread your last post but now assuming you do not know anything about what it is this person is asking or wanting to accomplish...

I guess you will agree that it doesn't make much sense ... :P

EDIT: ahh i see you editied it already:

Rule 1: you never have a func Always call itself ... this will always leads to a recursion level error.

There has to be a condition that will return to the previous called level.

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Oldschool

There has to be a condition that will return to the previous called level.

May I have a quick example please...

Share this post


Link to post
Share on other sites
Oldschool

In other words a better way to write this would be:

UDF1()

Func UDF1()
While 1

   While $var < 10
; do some stuff
       UDF2()
   WEnd
         While $var1 < 20
      ; do some stuff
            UDF3()
          WEnd
   While $var2 > 5
  ; do some stuff
      UDF4()
   WEnd

Wend
EndFunc

And then of course have the UDF2() - UDF4() Return

I can just use a blank Return? or it has to return a value?

Edited by Oldschool

Share this post


Link to post
Share on other sites
Jos

yes.. this will work fine ... (here is a version ran through tidy.exe

UDF1()

Func UDF1()
    While 1
        While $var < 10
    ; do some stuff
            UDF2()
        WEnd
        While $var1 < 20
    ; do some stuff
            UDF3()
        WEnd
        While $var2 > 5
    ; do some stuff
            UDF4()
        WEnd
    WEnd
EndFunc ;==>UDF1

its the same as doing it this way :

Global $var, $var1, $var2
While 1
    While $var < 10
; do some stuff
        UDF1()
    WEnd
    While $var1 < 20
; do some stuff
        UDF2()
    WEnd
    While $var2 > 5
; do some stuff
        UDF3()
    WEnd
WEnd

Func UDF1()
; do stuff
EndFunc ;==>UDF1
Func UDF2()
; do stuff
EndFunc ;==>UDF2
Func UDF3()
; do stuff
EndFunc ;==>UDF3
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Oldschool

Many thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×