Giter Club home page Giter Club logo

Comments (7)

yuleisui avatar yuleisui commented on September 27, 2024

This is likely due to the definition from a rust-specific external API call. Could you dump that pagnode and its llvm or using its toString method ?

from svf.

y1lan avatar y1lan commented on September 27, 2024

By setting SVFUtil::outs() in the following points:

inline NodeID getDef(const PAGNode* pagNode) const
    {
        SVFUtil::outs() << *pagNode << std::endl; // a new statement.
        PAGNodeToDefMapTy::const_iterator it = PAGNodeToDefMap.find(pagNode);
        assert(it!=PAGNodeToDefMap.end() && "SVFVar does not have a definition??");
        return it->second;
    }

void VFG::connectDirectVFGEdges()
{

    for(iterator it = begin(), eit = end(); it!=eit; ++it)
    {
        NodeID nodeId = it->first;
        VFGNode* node = it->second;

        if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast<StmtVFGNode>(node))
        {
            /// do not handle AddrSVFG node, as it is already the source of a definition
            if(SVFUtil::isa<AddrVFGNode>(stmtNode))
                continue;
            /// for all other cases, like copy/gep/load/ret, connect the RHS pointer to its def
            if (stmtNode->getPAGSrcNode()->isConstDataOrAggDataButNotNullPtr() == false){
                SVFUtil::outs()<< *stmtNode << "\n"; // a new statement.
                addIntraDirectVFEdge(getDef(stmtNode->getPAGSrcNode()), nodeId);
            }
....
}

Saber outputted

CopyVFGNode ID: 379 CopyStmt: [Var2036 <-- Var2033]
   %s = inttoptr i64 %c_string to ptr, !dbg !136 { "ln": 20, "cl": 21, "fl": "src/main.rs" }
ValVar ID: 2033
   %c_string = ptrtoint ptr %_2 to i64, !dbg !134 { "ln": 18, "cl": 33, "fl": "src/main.rs" }
saber: /SVF/svf/include/Graphs/VFG.h:428: SVF::NodeID SVF::VFG::getDef(const SVF::PAGNode*) const: Assertion `it!=PAGNodeToDefMap.end() && "SVFVar does not have a definition??"' failed.
[1]    230733 IOT instruction (core dumped)  ../../Debug-build/bin/saber -leak

before the assertion failure.

Note that function str_from_c, whose returned value is assigned to the variable %_2, was design by me and linked through Rust's FFI support.

from svf.

yuleisui avatar yuleisui commented on September 27, 2024

What is the PAGNode and SVFGNode at the assertion? It looks to me that these nodes are not on the PAG.

from svf.

y1lan avatar y1lan commented on September 27, 2024

Sorry, I am not very familiar with the data structures in SVF. If you are referring to the type const SVF::PAGNode , I believe that

ValVar ID: 2033
   %c_string = ptrtoint ptr %_2 to i64, !dbg !134 { "ln": 18, "cl": 33, "fl": "src/main.rs" }

was the one that triggered the assertion failure?

from svf.

yuleisui avatar yuleisui commented on September 27, 2024

Are you using the mainstream SVF, latest version?

Could you try wpa -ander -svfg to see whether the assertion is still there?

from svf.

y1lan avatar y1lan commented on September 27, 2024

Thanks! After pulling the latest version, the problem is resolved

from svf.

yuleisui avatar yuleisui commented on September 27, 2024

Sounds good.

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.