Giter Site home page Giter Site logo

libpointstodump's Introduction

libPointsToDump

Build Status CodeFactor License: GPL v3

  • Created a standard format to dump Points-to-Analysis in the specified format.
  • Provides API to any Analysis writer to dump the information in the standard format created.
  • Can export the information using the API provided in the library back in LLVM and use the information for any purpose.
  • This library also provides a test-suite using which one can analyze their soundness and precision score of their implementation.
  • Standard format makes use of JSON for representing the Points-to information.
  • Sample .pt dump can be accessed here.
  • We use this library to serialize/deserialize the input.

Installation

  • First clone this repoisorty.
    git clone https://github.com/mehul11jain/libPointsToDump.git
    
  • Building the project
    • Make a folder build inside the cloned repository.
    mkdir build
    cd build
    
    • Run the following commands.
    cmake ..
    sudo make install  
    

Using the library

  • To use this library we need working implementation of Pointer-analysis in llvm compiler tool-chain.
  • If the project is build using cmake genetated build files. Following statements need to be added to the CMakeLists.txt where the target is being generated.
    target_link_libraries(<TARGET_NAME>  PointsToDump)
    
  • We need to add the following lines of code to the outermost CMakeLists.txt
    add_library(PointsToDump SHARED IMPORTED)
    set_target_properties(PointsToDump PROPERTIES IMPORTED_LOCATION "/usr/local/lib/libPointsToDump.so")
    

API Functionalities

  • Functions to Create the standard .pt dump.

    • bool addPointsTo(llvm::Value*, llvm::Value*, PointeeType)
      • To add must Point-to information to the pt dump we must provide PointeeType::MustPointee as third argument.
      • To add may Point-to information to the pt dump we must provide PointeeType::MayPointee as third argument.
      • Returns 1 if success.
    • bool PointsToInfoAt(llvm::Instruction*)
      • To specify the instruction for which points-to relation is being defined.
      • Returns 1 if success.
    • bool AddProcdureInfo(llvm::Function*)
      • To specify the Function in which the instruction is present.
      • Returns 1 if success.
    • bool AddBasicBlockInfo(llvm::BasicBlock*)
      • To specify the Basic Block of current function we are specifying points-to information for.
      • Returns 1 if success.
    • bool isValidPTFormat(...)
      • To Check whether the .pt file created is according to the correct syntax.
      • Returns 1 if the .pt file is according to correct syntax.
  • Functions to query the information from the .pt dump.

    • std::vector<std::pair<std::string,std::string>> getMustPointsPairsAt(llvm::Instruction*)
      • Finds all the Must Points-to pairs from the .pt dump for the given instruction.
      • Returns the vector of pointer-pointee pair.
    • std::vector<std::pair<std::string,std::string>> getMayPointsPairsAt(llvm::Instruction*)
      • Finds all the Must Points-to pairs from the .pt dump for the given instruction.
      • Returns the vector of pointer-pointee pair.
    • void PrintPointsToDump()
      • Prints the points-to information in a file.
    • void printToDot(llvm::Instruction*)
      • Prints the points-to information in form of a dot file to visualize it as points-to graph.
    • bool isMustPointee(llvm::Instruction, llvm::Value*, llvm::Value*)
      • Return 1 if the specified pointer-pointee pair has a Must relationship at the given instruction.
    • bool isMayPointee(llvm::Instruction, llvm::Value*, llvm::Value*)
      • Return 1 if the specified pointer-pointee pair has a May relationship at the given instruction.
    • std::vector<std::string> getPointeeOf(llvm::Instruction, llvm::Value*)
      • Return a vector of all the pointees of a given pointer at the specified instruction.

libpointstodump's People

Contributors

mehul11jain avatar

Watchers

James Cloos avatar Reshabh K Sharma 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.