function::symname - Linux
Overview
The function::symname
command provides a simple interface for generating symbolic names (symnames
) based on a function’s address. This is useful for creating human-readable names for functions in debugging and profiling scenarios, or for generating symbols for kernel modules.
Syntax
function::symname [-a address] [-t type] [-s scope] [-a annotator] [-o output] [-f fmt] [-p pattern] [-I include_file]
Options/Flags
- -a address: Specifies a function address as hex value or symbolic name.
- -t type: Specifies the type of the symbol to generate. Default:
function
. - -s scope: Sets the scope of the symbol. Default:
local
. - -a annotator: The annotator to use for generating the symbol name. Default: linear.
- -o output: Specifies the output file. Default: stdout.
- -f fmt: Specifies the output format. Default:
%s
. - -p pattern: Filters symbols based on pattern.
- -I include_file: Includes extra symbols from a file.
Examples
Generate a symname for a function address:
$ function::symname -a 0xc0000000
Generate a symname for a specific type:
$ function::symname -t global -a 0xc0000000
Generate a symname with a custom pattern:
$ function::symname -p init -a 0xc0000000
Common Issues
Incorrect Address
Ensure that the provided function address is valid and within the executable’s memory space.
No Symbol Found
If no symbol is found for the given address, try using a different annotator (-a
option) or including additional symbols (-I
option).
Integration
function::symname
can be used in conjunction with other Linux tools, such as:
objdump
: Generate symnames for disassembly output.readelf
: Extract symnames from ELF binaries.
Related Commands
objdump
readelf
perf