function::usymfileline - Linux


function::usymfileline command in Linux enables users to generate a string containing the file and line number of a function’s first instruction. It’s primarily used in debugging and diagnostics to establish the exact source of errors or malfunction within a given section of code.


function::usymfileline [-h] [-V] [-f] [-e] [-x] <filename> <function_name>


  • -h, --help: Displays a help message and exits.
  • -V, --version: Displays version information and exits.
  • -f, --file-only: Prints only the file name.
  • -e, --function-only: Prints only the function name.
  • -x, --debug: Enables debug mode, providing additional output for tracking purposes.


To print the file and line number for the main function in example.c:

$ function::usymfileline example.c main

To print only the file name:

$ function::usymfileline -f example.c main

To print only the function name:

$ function::usymfileline -e example.c main

Common Issues

  • If the specified file or function does not exist, the command will return an empty string.
  • If the debug mode (-x) is enabled, a large amount of diagnostic output may be generated, which can potentially overwhelm the user. In such cases, it’s recommended to use this option sparingly.


function::usymfileline can be combined with other tools for more advanced diagnostics. For instance, it can be used in conjunction with gdb to provide more contextual information during debugging sessions.

Related Commands

  • objdump: Provides detailed information about object files, including symbol tables and line number mappings.
  • readelf: Reads and displays information from ELF headers, including symbol tables.
  • addr2line: Translates addresses from binary files into line numbers in source files.