GithubHelp home page GithubHelp logo

lanamorgan / wiretap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ucla-pls/wiretap

0.0 4.0 0.0 956 KB

An instrumenter for dynamic logging for java bytecode programs

License: MIT License

Java 98.58% HTML 1.25% Shell 0.09% Python 0.08%

wiretap's Introduction

Wiretap

Wiretap is a project meant to trace information of running a java program. This information can be used to create dynamic analyses that can run after the fact. This project aims to

  • scale, it needs to run fast;
  • be extendable, it can track different things;
  • thread safe;
  • and be re-playable, so a trace can be reproduced.

Wiretap should work with java's down to version 1.6.

Getting Started

Wiretap is implemented as a java agent. To run it write

java -javaagent:wiretap.jar -Dwiretap.recorder=<recorder>.. normal parameters 

This will by default create a wiretap folder _wiretap/, which will contain logs of the execution of the program. As a default the program will log enough to be able to replay itself.

If you have build the test submodule baseline, then you can test it all with this command:

java -javaagent:build/wiretap.jar \
  -cp test/baseline/build/baseline.jar \
  edu.ucla.pls.baseline.Transfer

Output Defined

The _wiretap/ folder contain these files:

  • classes.txt a list of classes encountered by wiretap, in chronological order.
  • methods.txt a list of methods instrumented by wiretap. The methods are formatted like this:
    <FullyQualifiedMethod>:(<Signature>)<ReturnType>
    
    Stuff that still needs to be worked on: [ ] Find a good way to represent the GenericSignature, Should it replace the Signature?

Wiretaps

Wiretaps are installed by a Wiretapper. A wiretapper is essentially a wrapper around the constructor for the Wiretap. It also has the ability to add information about the wiretap and inspect the recorder to see if it can accept the events that the Wiretap emit.

Recorder

A recorder is something that can handle incoming events. The recorder is statically linked to the main program, so it has to implement at least the following static methods:

public static <Recorder> getRecorder(); 
public static void setupRecorder(WiretapProperties); 
public static void closeRecorder(); 

Also it has to implement the methods for all the event that it will accept.

Note: Recorders can be chained if some of the events has to be processed.

Currently Implemented Recorders

A full list can be found in src/main/edu/ucla/pls/wiretap/recorders/

  • ReachableMethods - Outputs the reachable methods of a program with no repetition in the order they where encounterd in the program.
  • BinaryHistoryLogger - Logs alot of event in a binary file wiretap.hist. The format is described in wiretap-tools repository.

Building from Source

Run ant in the main repository.

Q&A

  • Why not instrument before running the program? The problem is that some programs hot-loads classes that did not statically exist in the program before running the program. To cover all cases, and the actual behavior of the program we have to instrument as the classes are loaded by the class loader.

Todos

  • Create a test that figures out if extended inherits graph and information is needed. The special case is the Thread.start(). Is it possible that if a class extends Thread that the implementation won't catch that. ( This does seam to be confirmed)

  • Create a Trie for ignore classes.

  • Improve logging speed.

DDBING

$ java -ea -javaagent:../wiretap/build/wiretap.jar
-Dwiretap.recorder=ABCDRecorder -cp test/abcd/classes/ BetterTest

$ java -ea -javaagent:../wiretap/build/wiretap.jar
-Dwiretap.recorder=ABCDReplayer -Dwiretap.replayfile=assert.log -cp
test/abcd/classes/ BetterTest

wiretap's People

Contributors

bchalala avatar kalhauge avatar lanamorgan 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.