Coder Social home page Coder Social logo

dynagrok's Introduction

Dynagrok

Dynagrok is a dynamic analysis tool for Go. It generates control flow graphs, call graphs and control depence graphs. It even has a random code mutator. It also performs a number of analyses, such as:

  • Code clone detection
  • Statistical fault localization
  • Test case pruning

Installation

The following process chooses ~/dev/go-research for dynagrok's GOROOT, ~/dev/dynagrok for dynagrok's GOPATH. You can set these to different locations, but make sure you're consistent about it.

Step 0: Preliminary

0.1: Install go

Make sure you have a working go installation, with proper configuration. The official website can help with this.

0.2: Install dep

Dep is the unofficial dependency management tool of Go. It is required to set up dynagrok for the first time. Run the following command:

go get -u github.com/golang/dep/cmd/dep

Step 1: Compile a compiler

For compiling instrumented binaries, Dynagrok uses an augmented version of the Go compiler. Rather than messing with the Go compiler you use every day, you'll want to have a separate one for use with Dynagrok.

1.1: Install go1.4

Go compilers compile themselves, but they need help from a bootstrap compiler. Go 1.4 is our bootstrap compiler. We'll install this to ~/go1.4, but you can put it wherever you like, as long as you set $GO_BOOTSTRAP to that directory.

Install the right go1.4 for your platform. Binaries can be found here. You may follow the instructions here but do not set your GOROOT or GOPATH to this.

1.2: Clone the compiler and checkout the right version

We'll clone this to ~/dev

cd ~/dev
git clone https://go.googlesource.com/go go-research
cd go-research
git checkout release-branch.go1.8

1.3: Build from source

cd ~/dev/go-research/src
./all.bash

Step 2: Create an isolated GOPATH

We'll create this at ~/dev/dynagrok, and it will be the root of the GOPATH for dynagrok, but the project itself will live in ~/dev/dynagrok/src/github.com/timtadh/dynagrok

mkdir -p ~/dev/dynagrok/{src,bin,lib}
mkdir -p ~/dev/dynagrok/src/github.com/timtadh/

Step 3: Install dynagrok

cd ~/dev/dynagrok/src/github.com/timtadh
git clone http://github.com/timtadh/dynagrok
cd ~/dev/dynagrok/src/github.com/timtadh/dynagrok
git submodule init # initialize submodules
git submodule update # install submodules (requires github to have your ssh key)

The .activate script sets the environment to their proper values for a dynagrok session. It must be sourced before every session. The last line of the file is for building a sub-utility and ought to be removed.

vim .activate # Edit `.activate` to remove the last line
source .activate

Then,

dep ensure # install remaining dependencies

Step 4: Test your installation

Build dynagrok

go install github.com/timtadh/dynagrok

Compile an example program:

dynagrok -r ~/dev/go-research -d ~/dev/dynagrok/src/github.com/timtadh/dynagrok
-g ~/dev/dynagrok/src/github.com/timtadh/dynagrok/examples objectstate
--keep-work -w /tmp/work dynagrok/examples/linkedlist

Usage

At the start of each dynagrok session, make sure to run

source .activate

dynagrok --help should also be helpful for viewing usage information.

Under the hood

dynagrok's People

Contributors

jkobyp avatar timtadh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.