Help: How to order the callees of a method selected using polyCalls+ in a DFS order. #14041
Replies: 1 comment
-
Hi @oriana19993926782, so sorry for the delay in responding to you about this! Broadly speaking, we make no guarantees about the order in which queries return their results. You should expect them to essentially be random. Query results can be ordered with Let me know if that's enough to steer you in the right direction or if you need more help, or if you have already figured it out in the time since posting your question. Sorry again for the long delay in a response here! |
Beta Was this translation helpful? Give feedback.
-
I am trying to let chatGPT do some static analysis for some methods in a java project. In order for chatGPT to fully understand the behavior of a method, I used the
polyCalls+()
to select all the callee methods that are called by a target method. But the callee methods in the results are not listed/arranged in the same order as they are called inside the target method body. If you think of call hierarchy or call graph as a ordered-tree, our target method is the root, and the callee methods are the nodes, the order I am talking about here will be Pre-order Traversal(one specific type of Depth-First Search, DFS )Take a simple java method named
isJobNodeExisted
from apache/shardingsphere-elasticjob for example:Below is the call hierarchy of this
isJobNodeExisted
, the callee methods in white from top to down is in the order they are called inside the body of thisisJobNodeExisted
.(I get this call hierarchy by usingcmd + shift + H
on a target method in IDEA.)However, the callees of
isJobNodeExisted
I selected usingployCalls+()
is listed/arranged in a very strange and confusing order. For example, the calleehandleException
further directly callsRegException
andisIgnoredException
, which you can see from following code.However, in the query result(pic below), the direct caller of
RegException
andisIgnoredException
, which ishandleException
here, is actually located in between these two. The order here is messy.The confusing order of callees here makes it really hard for me or chatGPT to do static analysis. I wonder what kind of order pattern in which codeQL are presenting the callees in the results?
Is there any way for me to get the callees in the same order as they are actually called inside my target method body or re-order the callees in a DFS order?
Below is my query to get all the callees of a target method
isJobNodeExisted
. Greatly appreciate guidance on this DFS order problem! Many thanks!!!Beta Was this translation helpful? Give feedback.
All reactions