All Projects → sciencemanx → ftrace

sciencemanx / ftrace

Licence: other
trace local function calls like strace and ltrace

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ftrace

Open C Book
开源书籍:《C语言编程透视》,配套视频课程《360° 剖析 Linux ELF》已上线,视频讲解更为系统和深入,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 715 (+1091.67%)
Mutual labels:  debugging, elf
Libobjectfile
LibObjectFile is a .NET library to read, manipulate and write linker and executable object files (e.g ELF, DWARF, ar...)
Stars: ✭ 63 (+5%)
Mutual labels:  debugging, elf
dwex
DWARF Explorer - a GUI utility for navigating the DWARF debug information
Stars: ✭ 58 (-3.33%)
Mutual labels:  debugging, elf
Mediator
Cross-platform GUI gRPC debugging proxy
Stars: ✭ 36 (-40%)
Mutual labels:  debugging
elfloader
load so file into current memory space and run function
Stars: ✭ 39 (-35%)
Mutual labels:  elf
es6-debug-webstorm
How to debug ES6 in Webstorm (using gulp)
Stars: ✭ 60 (+0%)
Mutual labels:  debugging
programanalysiscourse
COM S 413/513 and CPR E 513 Foundations and Applications of Program Analysis @ Iowa State University
Stars: ✭ 19 (-68.33%)
Mutual labels:  debugging
madbomber
Backtrace-on-throw C++ exception logger
Stars: ✭ 17 (-71.67%)
Mutual labels:  debugging
ycecream
Sweeter debugging and benchmarking Python programs.
Stars: ✭ 38 (-36.67%)
Mutual labels:  debugging
caddy-trace
Request Debugging Middleware Plugin for Caddy v2
Stars: ✭ 25 (-58.33%)
Mutual labels:  debugging
guide-charles-proxy
Charles - Web Debugging Proxy Application. I want to share my experiences when I worked with Charles. It is such an amazing application for debugging and testing the presentation of UI when trying different set of data. Hope you guys will master Charles after reading this section. Let’s find out! 🖍
Stars: ✭ 22 (-63.33%)
Mutual labels:  debugging
injectURLProtocol
cycript script for injecting a custom NSURLProtocol into a running application
Stars: ✭ 25 (-58.33%)
Mutual labels:  debugging
mutator
mutator is an experimental suite of tools aimed at analysis and automation of C/C++ code development
Stars: ✭ 62 (+3.33%)
Mutual labels:  elf
WinDbg Scripts
Useful scripts for WinDbg using the debugger data model
Stars: ✭ 92 (+53.33%)
Mutual labels:  debugging
pugdebug
pugdebug is a standalone debugging client for PHP applications that uses XDebug as the debugging engine.
Stars: ✭ 72 (+20%)
Mutual labels:  debugging
gdbstub
An ergonomic and easy-to-integrate implementation of the GDB Remote Serial Protocol in Rust, with full no_std support.
Stars: ✭ 158 (+163.33%)
Mutual labels:  debugging
clodl
Turn dynamically linked ELF binaries and libraries into self-contained closures.
Stars: ✭ 136 (+126.67%)
Mutual labels:  elf
Code-Trouble
No description or website provided.
Stars: ✭ 14 (-76.67%)
Mutual labels:  debugging
symbol-collector
Clients and Server to collect system symbols.
Stars: ✭ 20 (-66.67%)
Mutual labels:  elf
jquery-manager
Manage jQuery and jQuery Migrate on a WordPress website, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress
Stars: ✭ 27 (-55%)
Mutual labels:  debugging

ftrace

ltrace/strace but for local functions

Contents

Introduction

The basic idea behind the implementation is:

  1. Read in ELF file and identify symbols
  2. Fork and ptrace target process
  3. Add breakpoints to all symbols
  4. Catch breakpoints and log function call; additionally, add a temp. breakpoint to return pointer (for decreasing depthing and logging return value)
  5. Repeat

Some other fancy stuff happens in the background. For instance, if no header file is provided simple taint analysis is done on functions to determine the number of function arguments.

Installation

Usage

./ftrace <program> [arg 1] [arg2] ...

Optional parameters

  • -C - adds colored output
  • -H <file> - header file to use for function logging
  • -R - display function return values
  • -o <file> - specifies output file (replaces stderr)
  • -h - display this message

Example

test.c

#include <stdio.h>
#include <stdlib.h>

int fib(int n) {
	if (n == 0 || n == 1) return 1;
	else return fib(n - 1) + fib(n - 2);
}

int main(int argc, char **argv) {
	int n = atoi(argv[1]);
	printf("%d\n", fib(n));
	return 0;
}
$ gcc -o test test.c
$ ./ftrace ./test 3
_start()
__libc_csu_init(2, *0x7ffe0cb39158, *0x7ffe0cb39170)
main(2, *0x7ffe0cb39158)
fib(3)
  fib(2)
    fib(1)
    fib(0)
  fib(1)
3

Future work

Dependencies

Limitations

  • Currently only compatible with 64 bit ELF files.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].