Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preform analysis on all dump statements within package #13

Open
bestchai opened this issue May 26, 2020 · 0 comments
Open

Preform analysis on all dump statements within package #13

bestchai opened this issue May 26, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@bestchai
Copy link
Member

bestchai commented May 26, 2020

Dataflow analysis occurs at the functional level, and it should be extended to work at the package level. As an introductory approach all conditional statements should be considered as valid paths.

  • Every dump statement within a package should be analysed
  • Analysis should be preformed on nested function, if they are present in the same package
  • Analysis should be done into if statements
  • Analysis should be done into for loops
  • Analysis should be done into switch statements

#examples

#local functions

#!go
func foo( var ) type {
   var2 := global + var
   bar(var2)
   return var2
}

func bar( var ) {
   otherGlobal = var2
   return
}

main () {
 buf := receive()
 in := instrumenter.Unpack(buf)
 res := foo( in )
 //dump
} 

Here dataflow analysis should be preformed on the function foo and bar the variables affected by the receive are otherGlobal, var2,in, and res.

##if

#!go
    //@dump
    if ( conditional ) {
          var1 := external.foo()
          buf = var1
   } else {
          var2 := external.bar()
          buf = var2
   }
   out := instrumenter.Pack(buf)
   send(buf)

In this scenario the variables should be collected regardless of the path taken at runtime. The resulting dump statement should contain the variables {var,var2,buf}

##for

#!go
   buf := receive()
   in := instrumenter.Unpack(buf)
   for ( conditional ) {
        a := goHome(in)
        b := goToSleep(a)
        c := upAgainEarly(b)
   }
   //@dump

Here the variables {a,b,c} should all be logged regardless of the value of conditional or if the for loop was ever executed, furthermore analysis should be preformed on the local functions, any resulting variables should be logged as well.

##switch

#!go
   //@dump
   switch(conditional) {
   case: "vampire"
       buf := holyWater()
   case: "wearwolf"
       buf := silverBullet()
   case: "zombies"
       buf := shotgun()
   }
   send(instrumenter.Pack(buf))

Here variables affected by executing any of the local functions should be logged

[Issue created by wantonsolutions: 2015-08-21]

@bestchai bestchai added the enhancement New feature or request label May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant