Sign in to follow this  
Followers 0
MvGulik

Function recursion scanning (?)

6 posts in this topic

Just thinking/working on some source code recursion scanner. (nothing fancy, just a basic potential problem locator/scanner)

But I'm kinda at a loss at finding a nice or good way go about is.

Steps that passed my mind.

- Find all function(definitions) names. [working]

- Get hold of function code. (from full source) [working]

- Scan function code for calls to other function. [initial scan: working]

At this point I got array(s) with:

- User-function(def) names.

- User-function(unique) call count from that function. (+names of those calls)

Here is where I kinda run out of ideas. :mellow:

Probably just need some more time to come up with something ...


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

... almost done with initial working version by the looks of it. :mellow:

Mmm, If you like me to test run it on your code. Prep link, to source, in zip. (unless its some small code case.)

(normal function calls support only. So 'OtherFunction' in (for example) AdlibRegister("OtherFunction") are ignored.)

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

So... you can search the function in the script, but you can not find the function called inside the function?... the /striponly parameter of the offucscator will find all the function used and put it in the script, maybe you can look the way that the ofuscator do his things to find out that.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

... but you can not find the function called inside the function?

No silly. :mellow:

I just did not spend any time on scanning for function call's that are made from things like GUICtrlSetOnEvent(<CTRL-ID>, "function") or AdlibRegister("function").

When things are working ok, adding that part should not be a problem. But its currently not a priority to me. (ergo: not supported (yet))

---

But, yea ... description of the function call type's I was revering to was truly unclear.

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Sorry but my english in not very good and sometimes i can not undertand the meaning :S can you be more clear?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not sure if 'I' can be more clearer ... trying anyway.

The code target(idea) is to look for possible/potential function call paths that can be taken inside a given code source.

With the initial idea to detect/locate function-call recursion/loops, spanning multiple functions. But I imaging the data might also be used for other things. Like creation a flow-chart displaying the function links ...

But I suck at the data management that is involved with tree-like data collections.

So the last part is somewhat the core of the OP question.

Example: (from a previous test run.)

Paths found.

A>B1>C1:[END]
A>B1>C2>C1:[END]
A>B2>D1:[END]
A>B2>D2>D1:[END]
A>B2>D3>D2>D1:[END]
Based on the following test-code setup.
Func A()
    B1()
    B2()
EndFunc
Func B1()
    C1()
    C2()
EndFunc
Func B2()
    D1()
    D2()
    D3()
EndFunc
Func C1()
    ;; terminator.
EndFunc
Func C2()
    C1()
EndFunc
Func D1()
    ;; terminator.
EndFunc
Func D2()
    D1()
EndFunc
Func D3()
    D2()
EndFunc

- Currently trying to get rid of the issues that surfaced when test running it on some real source codes.

---

Got tangled up in the data management I used ... need to take a step back and take a other look at it. (progress on hold)

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

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  
Followers 0

  • Similar Content

    • careca
      By careca
      Hi, having an issue with an application i did, seems to crash randomly, and can take hours to do so.
      Simply says in the error msgbox:
      AutoIt Error
      Line 16392 (whatevermyapppath.exe)
      Error: The requested action with this object has failed.
       
      Recent changes to the script include this:
       
      ObjGet("winmgmts:\\localhost\root\CIMV2") $oSelect_active_network_cards = $objWMIService.ExecQuery('SELECT ProductName FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2 OR NetConnectionStatus = 9', "WQL") For $oSelect_active_network_card In $oSelect_active_network_cards $Adapter = $oSelect_active_network_card.ProductName Next Is the only thing i can see that can be related to an "object"
      This lines run only once at the top of the script.
      When i run the script itself and wait for a crash, it doesn't, or at least yet i didn't.
      What do you think this error could be?
      UPDATE: Runing the script eventually output this:
      "C:\script.au3" (894) : ==> The requested action with this object has failed.:
      $oNetwork_cards = $objWMIService.ExecQuery('SELECT BytesReceivedPerSec, BytesSentPerSec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE name LIKE "' & $Adapter & '"', "WQL")
      $oNetwork_cards = $objWMIService^ ERROR
    • gononono64
      By gononono64
      Hey there,
      I'm having some issues quick-sorting my 2d array imported from a database. Im trying to sort the array based on the name that would be returned in $array[$n][2]. The code i posted works for smaller arrays but for some reason when i try to sort my imported array (around 9000 indexes), I get "Recursion level has been exceeded". I understand that this is maybe due to lack of returns but i couldn't find an ideal spot to stick em and again it seems to work with smaller bits of code. Could it be that 9000 is too much?
      I would normally just trial and error it until i figured it out but due to the length of time to load and buffer my array it's become too time consuming. Really I'm just hoping there is a quick fix that someone with more experience happens to know.
      Thank you
       
      ;;---------------------------------------------This Works---------------------------------------------------- Local $a[7][2] = [ _ ["1", "asdfashks"], _ ["2", "SubStrlkghjing1"], _ ["3", "jdfghjsergh"], _ ["4", "nertynert"], _ ["5", "cvbncvjkrt"], _ ["6", "avbncvjkrt"], _ ["7", "oytuoyuop"]] Quicksort($a,1,0,6) _ArrayDisplay($a) ;;------------------------------------------This Does Not--------------------------------------------------------- Quicksort($aLargeData, 1, 0, Ubound($aLargeData) - 1) _ArrayDisplay($aLargeData) ;;----------------------------------------Quicksort Function------------------------------------------------------ Func Quicksort(ByRef $Array, $secondIndex, $First, $Last) Local $pivot, $i, $j, $temp If $First < $Last Then $pivot = $First $i = $First $j = $Last While ($i < $j) While (StringCompare($Array[$i][$secondIndex], $Array[$pivot][$secondIndex]) <= 0) And ($i < $Last) $i += 1 WEnd While (StringCompare($Array[$j][$secondIndex], $Array[$pivot][$secondIndex]) > 0) $j -= 1 WEnd If ($i < $j) Then _ArraySwap($Array, $i, $j) _ArraySwap($Array,$pivot,$j) Quicksort($Array, $secondIndex, $First,$j-1) Quicksort($Array, $secondIndex, $j+1,$Last) WEnd EndIf EndFunc  
    • aiter
      By aiter
      Anyone knows how to download the graphical autoitdebugger
      The download appears to have upped and died.
      Or an alternative?
       
       
    • Darien
      By Darien
      When an error occurs in a compiled script, the line number where the error occurred does not match. I noticed that blank lines and lines with only comments are ignored. in the attached example, it is advised that the error occurred on line 2, although in line 4. How to make it warned the correct line?
      teste.au3
    • valdemar1977
      By valdemar1977
      Dbug is graphical debugger for AutoIt.
      Project started by @Heron in 2009 and now supported by @asdf8 and @valdemar1977
      Features
      Debug the complete script or just parts of it Display run status (line number of currently executed function) GUI default always-on-top in the upper right corner for comfortable debugging WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers Display scope, type and value of variables, expressions, macro's and constants (global AND function local) Execute commands in an immediate window. Can be expressions, functions and assignments Detailed display of array, struct and object variables Dynamic display of variable value in the source code (under cursor) Array table viewer with ability to view the sub-arrays, the correct handling of macro @Error, @Extended and other changes OEM and ANSI console output Conditional breakpoints Saving settings and debugging state and much more...