You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to collect the use-def chain from a specific target point in the program, essentially performing backward slicing. After reviewing the example code (see https://github.com/SVF-tools/SVF-example), it appears that the traverseOnVFG function only handles use-def chains for top-level variables.
void traverseOnVFG(const SVFG* vfg, Value* val)
{
SVFIR* pag = SVFIR::getPAG();
SVFValue* svfval = LLVMModuleSet::getLLVMModuleSet()->getSVFValue(val);
PAGNode* pNode = pag->getGNode(pag->getValueNode(svfval));
const VFGNode* vNode = vfg->getDefSVFGNode(pNode);
FIFOWorkList<const VFGNode*> worklist;
Set<const VFGNode*> visited;
worklist.push(vNode);
/// Traverse along VFG
while (!worklist.empty())
{
const VFGNode* vNode = worklist.pop();
for (VFGNode::const_iterator it = vNode->OutEdgeBegin(), eit =
vNode->OutEdgeEnd(); it != eit; ++it)
{
VFGEdge* edge = *it;
VFGNode* succNode = edge->getDstNode();
if (visited.find(succNode) == visited.end())
{
visited.insert(succNode);
worklist.push(succNode);
}
}
}
/// Collect all LLVM Values
for(Set<const VFGNode*>::const_iterator it = visited.begin(), eit = visited.end(); it!=eit; ++it)
{
const VFGNode* node = *it;
/// can only query VFGNode involving top-level pointers (starting with % or @ in LLVM IR)
/// PAGNode* pNode = vfg->getLHSTopLevPtr(node);
/// Value* val = pNode->getValue();
}
}
For address-taken variables, is there an existing function I can leverage, or would I need to implement my own function to trace them? Additionally, are there any examples I can refer to for learning how to collect address-taken variables under SVF framework?
Thanks,
Andrew
The text was updated successfully, but these errors were encountered:
bao00065
changed the title
Collect Def-Use chain
Collect Use-Def chain
Oct 9, 2024
Hi,
I am trying to collect the use-def chain from a specific target point in the program, essentially performing backward slicing. After reviewing the example code (see https://github.com/SVF-tools/SVF-example), it appears that the traverseOnVFG function only handles use-def chains for top-level variables.
For address-taken variables, is there an existing function I can leverage, or would I need to implement my own function to trace them? Additionally, are there any examples I can refer to for learning how to collect address-taken variables under SVF framework?
Thanks,
Andrew
The text was updated successfully, but these errors were encountered: