Jump to content

Debugging a compiled script...


 Share

Recommended Posts

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??

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Developers

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 ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...