Question about missing DFG edges when generating CPG from C++ code #2476
Replies: 2 comments
-
|
Hello :) thanks for taking interest in our project. To help you I would need some further information from you:
Best regards, |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@kimchangsu9487 Did you solve your issue, or does it persist? If you have the time to follow up on my questions above, I would love to investigate the Issue. Otherwise, I will consider closing this discussion. Best regards, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello — and first of all, thank you for your hard work on this project. I really appreciate the effort you’ve put into developing and maintaining it.
I’m using this project for research to analyze C++ code. I wrote the following Kotlin snippet to extract the CPG, DFG, and related structures from C++ sources:
Kotlin Code
I noticed that Codyze creates many nodes in DirtyNode, but I don’t see any CPG/DFG edges in the result.
What I expected was the data flow graph edges described on this page:
https://github.com/Fraunhofer-AISEC/cpg/blob/main/docs/docs/CPG/specs/dfg.md
Is there something I’m missing or a configuration/pass I need to enable to get DFG edges?
Thanks in advance for any pointers or suggestions.
Best regards,
CS Kim
Analysis Result (TranslationManager Analyze Result)
additionalNodes: []
benchmarks: [de.fraunhofer.aisec.cpg.helpers.Benchmark@636e1bcd, de.fraunhofer.aisec.cpg.helpers.Benchmark@29443ae9, de.fraunhofer.aisec.cpg.helpers.Benchmark@1ac16861, de.fraunhofer.aisec.cpg.helpers.Benchmark@6f4757a2, de.fraunhofer.aisec.cpg.helpers.Benchmark@836a205, de.fraunhofer.aisec.cpg.helpers.Benchmark@4eb3f1fa, de.fraunhofer.aisec.cpg.helpers.Benchmark@5e4b04a9, de.fraunhofer.aisec.cpg.helpers.Benchmark@7b7d41e8, de.fraunhofer.aisec.cpg.helpers.Benchmark@51852fb9, de.fraunhofer.aisec.cpg.helpers.Benchmark@56238536, de.fraunhofer.aisec.cpg.helpers.Benchmark@59c12ff0, de.fraunhofer.aisec.cpg.helpers.Benchmark@52f1e504, de.fraunhofer.aisec.cpg.helpers.Benchmark@481b12e7]
componentDependencies: {Component[name=application,location=]=de.fraunhofer.aisec.cpg.helpers.IdentitySet@0}
componentEdges: [AstEdge[end=Component[name=application,location=]]]
components: [Component[name=application,location=]]
config:
{"addIncludesToGraph":true,"codeInNodes":true,"compilationDatabase":null,"debugParser":false,"disableCleanup":false,"disableTypeObserver":false,"exclusionPatternsByRegex":[],"exclusionPatternsByString":[],"failOnError":true,"functionSummaries":"de.fraunhofer.aisec.cpg.passes.inference.DFGFunctionSummaries@48e7b3d2","includeBlocklist":[],"includePaths":[],"includeWhitelist":[],"inferenceConfiguration":{"inferRecords":true,"inferDfgForUnresolvedCalls":true},"languages":["class de.fraunhofer.aisec.cpg.frontends.cxx.CPPLanguage"],"loadIncludes":false,"matchCommentsToNodes":false,"maxPassExecutions":5,"passConfigurations":{},"processAnnotations":false,"registeredPasses":[["class de.fraunhofer.aisec.cpg.passes.ImportResolver"],["class de.fraunhofer.aisec.cpg.passes.TypeResolver","class de.fraunhofer.aisec.cpg.passes.ResolveMemberExpressionAmbiguityPass"],["class de.fraunhofer.aisec.cpg.passes.TypeHierarchyResolver","class de.fraunhofer.aisec.cpg.passes.CXXExtraPass"],["class de.fraunhofer.aisec.cpg.passes.ResolveCallExpressionAmbiguityPass"],["class de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass"],["class de.fraunhofer.aisec.cpg.passes.SymbolResolver"],["class de.fraunhofer.aisec.cpg.passes.DFGPass"],["class de.fraunhofer.aisec.cpg.passes.ControlFlowSensitiveDFGPass"],["class de.fraunhofer.aisec.cpg.passes.DynamicInvokeResolver"]],"replacedPasses":{},"softwareComponents":{"application":[".\abstract_hardware_model.cc"]},"symbols":{},"topLevels":{},"useParallelFrontends":false,"useParallelPasses":false,"useUnityBuild":false}
ctx: de.fraunhofer.aisec.cpg.TranslationContext@c96a4ea
dirtyNodes: {Reference[name=fgets,location=abstract_hardware_model.cc(60:10-60:15),type=FunctionType[name=fgets(char[], char[], FILE*)UNKNOWN],refersTo=FunctionDeclaration[name=fgets,location=,parameters=[ParameterDeclaration[name=charPtr0,location=], ParameterDeclaration[name=charPtr1,location=], ParameterDeclaration[name=filePtr2,location=]]]]=[], RecordDeclaration[name=std::nullptr_t,location=,name=std::nullptr_t,kind=struct,superTypeDeclarations=[],fields=[],methods=[],constructors=[],records=[]]=[], Literal[location=abstract_hardware_model.cc(55:17-55:21),type=ObjectType[name=std::nullptr_t],value=]=[], NamespaceDeclaration[name=std,location=]=[], VariableDeclaration[name=fp,location=abstract_hardware_model.cc(47:8-47:18),initializer=Literal[location=abstract_hardware_model.cc(47:14-47:18),type=ObjectType[name=std::nullptr_t],value=]]=[], MethodDeclaration[name=simt_stack::resume,location=abstract_hardware_model.cc(51:1-64:2),parameters=[ParameterDeclaration[name=fname,location=abstract_hardware_model.cc(51:25-51:36)]]]=[], DeclarationStatement[location=abstract_hardware_model.cc(58:3-58:18),declarations=[VariableDeclaration[name=line,location=abstract_hardware_model.cc(58:8-58:17),initializer=]]]=[], Reference[name=assert,location=abstract_hardware_model.cc(55:3-55:9),type=FunctionType[name=assert(UNKNOWN)UNKNOWN],refersTo=FunctionDeclaration[name=assert,location=,parameters=[ParameterDeclaration[name=unknown0,location=]]]]=[], CallExpression[name=assert,location=abstract_hardware_model.cc(55:3-55:23),type=UNKNOWN]=[], CallExpression[name=fclose,location=abstract_hardware_model.cc(62:5-62:17),type=UNKNOWN]=[], CallExpression[name=reset,location=abstract_hardware_model.cc(52:3-52:11),type=UNKNOWN]=[], WhileStatement[location=abstract_hardware_model.cc(60:3-63:4),statement=Block[location=abstract_hardware_model.cc(61:3-63:4),type=UNKNOWN],else=,condition=BinaryOperator[lhs=fgets,rhs=,operatorCode=!=,location=abstract_hardware_model.cc(60:10-60:47)],conditionDeclaration=]=[], VariableDeclaration[name=line,location=abstract_hardware_model.cc(58:8-58:17),initializer=]=[],
Reference[name=reset,location=abstract_hardware_model.cc(52:3-52:8),type=FunctionType[name=reset()UNKNOWN],refersTo=FunctionDeclaration[name=reset,location=,parameters=[]]]=[], DeclarationStatement[location=abstract_hardware_model.cc(47:3-47:18),declarations=[VariableDeclaration[name=fp,location=abstract_hardware_model.cc(47:8-47:18),initializer=Literal[location=abstract_hardware_model.cc(47:14-47:18),type=ObjectType[name=std::nullptr_t],value=]]]]=[], Reference[name=fclose,location=abstract_hardware_model.cc(62:5-62:11),type=FunctionType[name=fclose(FILE*)UNKNOWN],refersTo=FunctionDeclaration[name=fclose,location=,parameters=[ParameterDeclaration[name=filePtr0,location=]]]]=[], AssignExpression[name==,location=abstract_hardware_model.cc(57:3-57:13),type=UNKNOWN]=[], Reference[name=line,location=abstract_hardware_model.cc(60:29-60:33),type=PointerType[name=char[]],refersTo=VariableDeclaration[name=line,location=abstract_hardware_model.cc(58:8-58:17),initializer=]]=[],
AstEdge[end=RecordDeclaration[name=FILE,location=,name=FILE,kind=struct,superTypeDeclarations=[],fields=[],methods=[],constructors=[],records=[]]],
AstEdge[end=NamespaceDeclaration[name=std,location=]], AstEdge[end=FunctionDeclaration[name=reset,location=,parameters=[]]],
AstEdge[end=FunctionDeclaration[name=assert,location=,parameters=[ParameterDeclaration[name=unknown0,location=]]]],
AstEdge[end=FunctionDeclaration[name=fgets,location=,parameters=[ParameterDeclaration[name=charPtr0,location=], ParameterDeclaration[name=charPtr1,location=], ParameterDeclaration[name=filePtr2,location=]]]],
AstEdge[end=FunctionDeclaration[name=fclose,location=,parameters=[ParameterDeclaration[name=filePtr0,location=]]]]]]=[],
BinaryOperator[lhs=fp2,rhs=,operatorCode=!=,location=abstract_hardware_model.cc(55:10-55:21)]=[], BinaryOperator[lhs=fgets,rhs=,operatorCode=!=,location=abstract_hardware_model.cc(60:10-60:47)]=[], ReturnStatement[location=,returnValues=[]]=[], Literal[location=abstract_hardware_model.cc(57:9-57:13),type=ObjectType[name=std::nullptr_t],value=]=[], ReturnStatement[location=,returnValues=[]]=[], UnaryOperator[name=sizeof,location=abstract_hardware_model.cc(60:22-60:33),type=PointerType[name=char[]],operatorCode=sizeof,postfix=false,prefix=true]=[], Block[location=abstract_hardware_model.cc(61:3-63:4),type=UNKNOWN]=[], CallExpression[name=fgets,location=abstract_hardware_model.cc(60:10-60:39),type=UNKNOWN]=[], Literal[location=abstract_hardware_model.cc(60:43-60:47),type=ObjectType[name=std::nullptr_t],value=]=[],
IncludeDeclaration[name=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,location=,name=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,filename=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,includes=[],problems=[]]=[], FunctionDeclaration[name=fopen,location=abstract_hardware_model.cc(46:1-49:2),parameters=[ParameterDeclaration[name=filename,location=abstract_hardware_model.cc(46:13-46:27)], ParameterDeclaration[name=option,location=abstract_hardware_model.cc(46:29-46:41)]]]=[], Literal[location=abstract_hardware_model.cc(47:14-47:18),type=ObjectType[name=std::nullptr_t],value=]=[], Literal[location=abstract_hardware_model.cc(54:28-54:31),type=PointerType[name=char[]],value=r]=[], RecordDeclaration[name=FILE,location=,name=FILE,kind=struct,superTypeDeclarations=[],fields=[],methods=[],constructors=[],records=[]]=[], Reference[name=line,location=abstract_hardware_model.cc(60:16-60:20),type=PointerType[name=char[]],refersTo=VariableDeclaration[name=line,location=abstract_hardware_model.cc(58:8-58:17),initializer=]]=[], Reference[name=fp2,location=abstract_hardware_model.cc(60:35-60:38),type=PointerType[name=FILE*],refersTo=VariableDeclaration[name=fp2,location=abstract_hardware_model.cc(54:8-54:32),initializer=CallExpression[name=fopen,location=abstract_hardware_model.cc(54:15-54:32),type=PointerType[name=FILE*]]]]=[], Reference[name=fp2,location=abstract_hardware_model.cc(62:12-62:15),type=PointerType[name=FILE*],refersTo=VariableDeclaration[name=fp2,location=abstract_hardware_model.cc(54:8-54:32),initializer=CallExpression[name=fopen,location=abstract_hardware_model.cc(54:15-54:32),type=PointerType[name=FILE*]]]]=[]}
finalCtx: de.fraunhofer.aisec.cpg.TranslationContext@c96a4ea
isCancelled: false
language: CPPLanguage[name=CPPLanguage,location=]
scratch: {sourceLocationsToFrontend={abstract_hardware_model.cc=CXXLanguageFrontend}}
translatedFiles: [abstract_hardware_model.cc]
translationManager: (접근 불가 또는 오류 발생)
translationUnits: [TranslationUnitDeclaration[declarations=[
AstEdge[end=FunctionDeclaration[name=fopen,location=abstract_hardware_model.cc(46:1-49:2),parameters=[ParameterDeclaration[name=filename,location=abstract_hardware_model.cc(46:13-46:27)], ParameterDeclaration[name=option,location=abstract_hardware_model.cc(46:29-46:41)]]]],
AstEdge[end=MethodDeclaration[name=simt_stack::resume,location=abstract_hardware_model.cc(51:1-64:2),parameters=[ParameterDeclaration[name=fname,location=abstract_hardware_model.cc(51:25-51:36)]]]], AstEdge[end=IncludeDeclaration[name=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,location=,name=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,filename=C:\Users\njkjh\Work\CpgGradle\abstract_hardware_model.h,includes=[],problems=[]]], AstEdge[end=RecordDeclaration[name=FILE,location=,name=FILE,kind=struct,superTypeDeclarations=[],fields=[],methods=[],constructors=[],records=[]]], AstEdge[end=NamespaceDeclaration[name=std,location=]], AstEdge[end=FunctionDeclaration[name=reset,location=,parameters=[]]], AstEdge[end=FunctionDeclaration[name=assert,location=,parameters=[ParameterDeclaration[name=unknown0,location=]]]], AstEdge[end=FunctionDeclaration[name=fgets,location=,parameters=[ParameterDeclaration[name=charPtr0,location=], ParameterDeclaration[name=charPtr1,location=], ParameterDeclaration[name=filePtr2,location=]]]], AstEdge[end=FunctionDeclaration[name=fclose,location=,parameters=[ParameterDeclaration[name=filePtr0,location=]]]]]]]
usedLanguages: [CPPLanguage[name=CPPLanguage,location=]]
additionalProblems: []
annotationEdges: []
annotations: []
argumentIndex: 0
assumptions: []
astChildren: [Component[name=application,location=]]
astParent: null
benchmarkResults: de.fraunhofer.aisec.cpg.helpers.BenchmarkResults@6c8a68c1
code: null
comment: null
id: 00000000-0000-0000-ffff-ffffce71fefe
isImplicit: false
isInferred: false
legacyId: null
location: null
name:
nextCDG: []
nextCDGEdges: []
nextDFG: []
nextDFGEdges: []
nextEOG: []
nextEOGEdges: []
nextFullDFG: []
nextPDG: []
nextPDGEdges: []
overlayEdges: []
overlays: []
prevCDG: []
prevCDGEdges: []
prevDFG: []
prevDFGEdges: []
prevEOG: []
prevEOGEdges: []
prevFullDFG: []
prevPDG: []
prevPDGEdges: []
scope: null
Beta Was this translation helpful? Give feedback.
All reactions