Skip to content

Preform analysis on all dump statements within package #13

@bestchai

Description

@bestchai

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions