function::caller_addr - Linux
Overview
function::caller_addr is a Linux command that displays caller addresses, providing insights into stack frame information for functions and libraries. Its primary use is in debugging and analyzing code behavior.
Syntax
function::caller_addr [<options>] <function> <address>
Options/Flags
- –addr: Use an address to look up functions
- –file: Use a file to look up functions
- –filter: Apply a filter to the output
- –format: Specify the output format (default:
raw
) - –symbol: Use a symbol to look up functions
Examples
1. Display caller addresses for a specific function:
function::caller_addr --file main.cpp --function main
2. Find caller addresses from an address:
function::caller_addr --addr 0x41f64c
3. Filter output by specific parameters:
function::caller_addr --file main.cpp --filter 'filename == "my_module.cpp"'
4. Change the output format:
function::caller_addr --file main.cpp --format json
Common Issues
- Unable to find caller address: Ensure the provided parameters are correct and that the specified file or address is accessible.
- Inconsistent output: Different versions of the compiler or system may affect the output format. Use the
--format
option to specify a consistent format.
Integration
1. Use with addr2line
: Identify the source code location corresponding to the caller address.
function::caller_addr --file main.cpp | addr2line -e a.out
2. Combining with perf
: Analyze performance data and pinpoint function boundaries.
perf record -e function -F 99
perf report -i callchain.out | function::caller_addr
Related Commands
- addr2line: Converts addresses to source code locations.
- readelf: Displays detailed information about ELF files.