Skip to content

Is it possible to display call path? #5353

Answered by intrigus-lgtm
Marcono1234 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this is possible!

The site you linked to mentions it here and here although it's easy too miss or easy to underestimate its potential.

When you use taint or data-flow the edges predicate is defined by the PathGraph module.
But you can also define your own edges query-predicate.

A self-defined query-predicate is used in @agustingianni's blog post. It's relatively easy to port the code to "Java CodeQL".

Here's my code that only creates a path for methods itself and not for the (control flow) basic-blocks.
Link to query

/**
 * @kind path-problem
 */

import java

class StartMethod extends Method {
  StartMethod() { getName() = "validateExpression" }
}

class TargetMethod extends Method {

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Marcono1234
Comment options

@Marcono1234
Comment options

@fan-tom
Comment options

Answer selected by Marcono1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants