Skip to content

CallPath lets you see all the paths your code take until a specified function.

License

Notifications You must be signed in to change notification settings

matheustavares/callpath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

CallPath (or cpath)

CallPath lets you see all the paths your code take until a specified function, in a particular execution. It does that running your code through gdb, parsing the output and feeding it to dot. It was design to work with C code but should work with any language supported by gdb.

Note: If you want to see all possible paths, not only the ones found on a single execution, use gcc-callgraph-plugin, which performs a static analysis.

Dependencies and Installation

Certify that you have all the following tools installed and acessible at your $PATH:

  • gdb
  • dot (usually from the graphviz package)
  • ruby

Then, just place cpath somewhere covered by your $PATH. You may also need to run chmod +x cpath.

Usage

$ cpath [<options>] -b|--break func1[,func2,...] -r|--run '<command> [args]'

where:

-b|--break specifies a list of functions to backtrace
-r|--run specifies the command to run and its arguments

and the additional options are:

-v, --[no-]verbose           Print progress messages (default)
-p, --[no-]print             Print list of paths found at stdout (default)
-g, --[no-]graph             Generate graph image at 'paths.png' using dot
-e, --redirect=FILENAME      Redirect your command's output to FILENAME
-h, --help                   Show this message

The output of --print will be a line for each path in the format:

A > B > ... > break_func (NUM)

Where NUM represents how many times the path has occurred.

Tips

Don't forget to compile your code with -g (or even better, with -g3). Also, you should use -O0 to disable compiler optimizations and have more reliable callgraphs.

About

CallPath lets you see all the paths your code take until a specified function.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages