function::symfileline - Linux


symfileline is a command-line utility for printing the name of the source file and line number associated with a given symbol in a DWARF debug information section. It allows developers to quickly locate the exact source code corresponding to a particular symbol in a compiled executable.


symfileline [-a] [-f] [-l] [-n] [-r] [-s] [-t] <symbol>


  • -a: Print all matching symbols.
  • -f: Only print the source file name.
  • -l: Only print the line number.
  • -n: Display the symbol name along with the file and line information.
  • -r: Print the source file and line information in reverse order (file:line instead of line:file).
  • -s: Suppress printing of the symbol name.
  • -t: Print the symbol table offset.


Find the source file and line number for a specific symbol:

$ symfileline main
main: ./main.cpp:10

Print only the source file name:

$ symfileline -f main

Print all matching symbols for a partial name:

$ symfileline -a foo
foo: ./foo.cpp:20
fooBar: ./bar.cpp:15

Common Issues

  • Ensure that the debug information is embedded in the executable.
  • If the symbol is not found, check if the correct symbol name is used and if the debug information is properly generated.


Combine with objdump to examine debug information:

$ objdump -d a.out | symfileline -a

Use in scripts to automate symbol lookup:


for symbol in $(nm a.out | grep main); do
  symfileline $symbol

Related Commands

  • objdump – Examine object files and display information about their contents.
  • nm – List symbols from an object file.
  • c++filt – Demangle C++ symbols.