Code Monkey home page Code Monkey logo

teaching-software-analysis's Issues

I have problem in CodeGraphs exercise.

Dear Sir,
I stuck in CodeGraphs exercise.
Segmentation fault occurs in line 55 in CodeGraph.cpp, so I find the location that segfault occurs.
How can I fix it?
Please give me any advice.

image

line 55 in CodeGraph.cpp

...
SVFIRBuilder builder;
...

getPAG() in line 55 in SVFIRBuilder.h

...
/// Constructor
SVFIRBuilder(): pag(SVFIR::getPAG()), svfMod(nullptr), curBB(nullptr),curVal(nullptr)
{
}
...

line 110 in getPAG in SVFIR.h

/// Singleton design here to make sure we only have one instance during any analysis
//@{
static inline SVFIR* getPAG(bool buildFromFile = false)
{
    if (pag == nullptr)
    {
        pag = new SVFIR(buildFromFile); // line 110 is here !
    }
    return pag;
}

call build function in line 45 in SVFIR Constructor in SVFIR.cpp

SVFIR::SVFIR(bool buildFromFile) : IRGraph(buildFromFile)
{
	icfg = new ICFG();
	ICFGBuilder builder(icfg);
	builder.build(getModule()); // line 45 is here !
}
  • getModule() returns nullptr. So, parameter of build() is nullptr

    // line 155~158 in SVFIR.h 
    inline SVFModule* getModule()
    {
    	return SymbolTableInfo::SymbolInfo()->getModule();
    }
    • SymbolInfo()->getModule()

      // line 157 ~ 161 in SymbolTableinfo.h
      /// Module
      inline SVFModule* getModule()
      {
      	return mod;
      }
    • SymbolTableInfo::SymbolInfo()

      *// line 59 ~ 67 in SymbolTableInfo.cpp*
      SymbolTableInfo SymbolTableInfo::SymbolInfo()
      {
      	if (symInfo == nullptr)
      	{
      		symInfo = new SymbolTableInfo();
      		symInfo->setModelConstants(Options::ModelConsts);
      	}
      	return symInfo;
      }
    • SymbolTableInfo Constructor

      • In line 116, mod initializes with nullptr
      // line 114 ~ 118
      /// Constructor
      SymbolTableInfo(void) :
      mod(nullptr), modelConstants(false), totalSymNum(0), maxStruct(nullptr), maxStSize(0)
      {
      }
    • setModelConstants()

      • Any lines not set mod variable
      void setModelConstants(bool _modelConstants)
      {
          modelConstants = _modelConstants;
      }

    → So, getModule() returns nullptr

  • line 41 ~ 54 in ICFGBuilder::build() in ICFGBuilder.cpp

    • Segfault occur in line 43. Because svfModule is nullptr
void ICFGBuilder::build(SVFModule* svfModule)
{
	for (SVFModule::const_iterator iter = svfModule->begin(), eiter = svfModule->end(); iter != eiter; ++iter)
	{
		const SVFFunction *fun = *iter;
		if (SVFUtil::isExtCall(fun))
			continue;
		WorkList worklist;
		processFunEntry(fun,worklist);
		processFunBody(worklist);
		processFunExit(fun);
	}
	connectGlobalToProgEntry(svfModule);
}

image

  • Before calling build(), I checked rsi register is null.

    Segmentation fault occur in mov 0x28(%rsi), %rsi instruction

    image

Some confusing problems when implementing Assignment 04.

Dear Sir,
I am currently working on assignment 04, and previous implementations on Assignment 01-03 works all fine. However, when I
try to run assignment 04, it fails, the report shows:
running test1:
[Pointer Analysis] Checking MAYALIAS
FAILURE :MAYALIAS check <id:15, id:15> at ({ ln: 16 cl: 5 fl: Assignment-4/testcase/src/test1.c })
assign-4: /home/SVF-tools/SVF/lib/MemoryModel/PointerAnalysis.cpp:629: virtual void SVF::PointerAnalysis::validateSuccessTests(std::string): Assertion `false && "test case failed!"' failed.

when I debug it with gdb, it seems like the problem is on ander->analyze().
The backtrace is as below:
image
I'm really confused since ander->analyze() works fine on assignment-3, any suggestions are really appreciated! Thanks!
Here is my e-mail address if discussing on github is not that desirable: [email protected] =)

Some questions about assignment-2

Hello dear author:
I really appreciate your SVF tool and the course you have provided. Thank you very much!
I have encountered some problems in assignment-2, I have followed your pseudocode in your PPT and unfortunately, the iter object in the picture below(type of ICFGEdge) is unable to be converted to CallCFGEdge type, so I can't get the instruction object by using getCallSite() function. The red lines below the code show the error part.
I have beed bothered with this problem for days. Can you offere me some advice?Thank you.

图片

Something Wrong with getting SourceLoc information

Teacher, I have a problem in getting SourceLoc info.
For detail, when I use the API SVF::SVFUtil::getSourceLoc provided in Wiki, VSCode show here is no method named getSourceLoc in namespace SVFUtil.
image
Then I read the source code of SVF, and find LLVMUtil::getSourceLoc(const Value* val), but I don't know how to cast ICFGNode to LLVM Value, are there any APIs I could use?
image

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.