function::ucallers - Linux


Overview

function::ucallers locates and prints all locations in the source code where a particular function is called. It is useful for analyzing code dependencies, tracing function calls, and identifying potential performance bottlenecks.

Syntax

function::ucallers [options] <function>

Options/Flags

| Option | Description | Default |
|—|—|—|
| -f | Parse function name from its full path | |
| -i | Ignore case when matching function names | |
| -n | Print only line numbers | |
| -r | Print relative paths to source files | |
| -s | Suppress unnecessary output | |
| -w | Print only file names | |

Examples

  • Print call locations for the main function:
function::ucallers main
  • Ignore case and print only line numbers:
function::ucallers -i -n strcmp

Common Issues

  • Ensure that the specified function name is accurate and exists in the source code.
  • If no matches are found, verify that the source code is included in the search path.
  • To exclude specific files or directories from the search, use grep or awk to filter the output.

Integration

function::ucallers can be integrated with other tools for advanced analysis:

  • ctags: Generate a tags file of the source code and use ctags -x to find call locations.
  • callgrind: Profile a program to identify frequently called functions and then use function::ucallers to trace their calls.

Related Commands

  • ctags
  • grep
  • awk
  • callgrind