Giter Club home page Giter Club logo

Comments (9)

yuleisui avatar yuleisui commented on May 28, 2024 2

Hello,

1) Using an existing pointer analysis.
The following gives you the most intuitive way to get the results of a flow-insensitive and field-sensitive pointer analysis (Andersen's analysis)

AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(svfModule);
ander->getPts(NodeID)

NodeID here represents a node (pointer variable) on PAG (refer to our wiki at https://github.com/SVF-tools/SVF/wiki/Technical-documentation#12-program-assignment-graph-pag).
Every pointer operand of an instruction (e.g., store or load) maps to a PAG Node. "ander->getPts(NodeID)" return a set of objects corresponding to LLVM allocation sites (Alloca, Global or heap allocations).

You may also wish to refer this thread in creating and using pointer analysis for indirect calls
#37

2) Writing a pointer analysis
You can create a new cpp file under the folder of "lib/WPA" and follow the following wiki to create a pointer analysis of your own.

https://github.com/SVF-tools/SVF/wiki/Write-a-flow--and-field---insensitive-pointer-analysis

from svf.

zyw-nine avatar zyw-nine commented on May 28, 2024

Thank you@yuleisui

from svf.

zhaogang92 avatar zhaogang92 commented on May 28, 2024

I am wondering if AndersenWaveDiffWithType is more precise than AndersenWave and FlowSensitive. I used these to check if an operand in LLVM IR can point to a heap memory object (at least one heap object in its points-to set). With AndersenWaveDiffWithType I got much less such operands. This is unexpected to me. I don't know where I am wrong.

from svf.

yuleisui avatar yuleisui commented on May 28, 2024

Yes, AndersenWaveDiffWithType is more precise given the type information is correctly reflected on LLVM IR.

from svf.

zhaogang92 avatar zhaogang92 commented on May 28, 2024

Do you mean it may not be conservative?

from svf.

yuleisui avatar yuleisui commented on May 28, 2024

Type information in C is OK so far. However, for C++, LLVM may not reflect the correct type information for classes since all types will be flattened base on bits after lowing IR.

Take a look at this: http://lists.llvm.org/pipermail/llvm-dev/2016-May/100139.html

Have you found any issue using AndersenWaveDiffWithType?

from svf.

zhaogang92 avatar zhaogang92 commented on May 28, 2024

I used it to check if an operand may point to a heap object for bzip2 (if its points-to set contains at least one heap object). If I use FlowSensitive PTA, I get 3848 such operands. But if I use AndersenWaveDiffWithType PTA, I only get 269 such operands. Such a reduction is not very reasonable to me. So I am wondering it is really conservative?

from svf.

yuleisui avatar yuleisui commented on May 28, 2024

You may wish to use the default AndersonWaveDiff solver. The diffWaveAnderseWithType is a new solver particularly for C++. It may not be converative as explained.

from svf.

zhaogang92 avatar zhaogang92 commented on May 28, 2024

OK. Thanks for explanation!

from svf.

Related Issues (20)

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.