Introducing ftrace

Ftrace V0.1 [[email protected]]


ftrace is a reverse engineering tool designed to help map out the execution flow of ELF executables (32bit and 64bit). Instead of printing system calls or library function calls, it prints out the local function calls as they are happening, and attempts to retrieve the function arguments and determine whether they are immediate or pointer type. As of version 0.1, function arguments are only shown for 64bit executables. This program is useful when wanting to see the function flow of a given executable during runtime without having to set incremental breakpoints and backtraces in a debugger like gdb. Ftrace relies on symbols for seeing a functions actual name, but the -S option will show function calls for functions without symbols as well, displaying them as sub_<addr>.



gcc ftrace.c -o ftrace



ftrace [-p <pid>] [-Stsve] <prog> <args>



For 32bit executables set FTRACE_ARCH=32, it defaults to 64.



[-v] Verbose output, print symbol table info etc.

[-p] This option is used to attach to an existing process ID.

[-s] This option will show strings as they are passed through functions (As best it knows how)

[-e] This will show certain ELF info such as symbols, and lists the shared library deps.

[-t] Type detection will guess what pointer type a function argument is, if it is a pointer.

It will detect pointers that are within the range of the text segment, data segment, heap and the stack.

[-S] Show function calls that don't have a matching symbol (For stripped binaries)



[email protected]:~/code/ftrace/ftrace$ ./ftrace -t /usr/bin/whoami[+] Function tracing begins here:[email protected]: __libc_start_main()[email protected]: strrchr(0x2f)[email protected]: __printf_chk(0x6,(text_ptr *)0x404444)[email protected]: bindtextdomain((text_ptr *)0x40448a,(text_ptr *)0x404498,(text_ptr *)0x40448a,(text_ptr *)0x404498)[email protected]: textdomain((text_ptr *)0x40448a,(text_ptr *)0x40448a,0x7f6197f75b90,(text_ptr *)0x40448a)[email protected]: getopt_long((text_ptr *)0x404444)[email protected]: __errno_location()[email protected]: geteuid()[email protected]: getpwuid()[email protected]: puts()[email protected]: fwrite()[email protected]: __fpending()[email protected]: malloc()[email protected]: realloc()[email protected]: realloc()[email protected]: __fpending()[email protected]: malloc()[email protected]: realloc()[email protected]: realloc()


  • Semi Rare EIO ptrace error (In progress to fix)
  • Memory leak with -s (In progress to fix)



  • Add support for function arguments on 32bit
  • Add support for following fork'd children of target process
  • Extend heuristics of 64bit procedure prologue calling convention for function args.
  • Add support for showing return value
  • Add function depth tracking for callgraph
  • Add dwarf2 support for .debug section to get function prototype info
  • Port to FreeBSD