Linux调试中的各种trace

Linux中有很多调试手段,很多trace,很让人迷糊,弄得云里雾里。
今天简单介绍下其中的几种trace:ptrace, strace, ltrace, ftrace 。
只是简单介绍它们的基本概念,对其有基本的了解,后面有机会的话,再逐个深入。

ptrace

官方手册说明:ptrace(2) - Linux manual page

The ptrace() system call provides a means by which one process (the “tracer”) may observe and control the execution of another process (the “tracee”), and examine and change the tracee’s memory and registers. It is primarily used to implement breakpoint debugging and system call tracing.
进程跟踪器,类似于gdb watch的调试方法

ptrace是一个系统调用,通过它,一个进程(“tracer”)可以观察和控制另一个进程(“tracee”)的执行,基于它可以实现断点调试和系统调用的跟踪。后面要说的strace就是基于它实现的,还有大名鼎鼎的gdb也是以它为基础的。

strace

。。。。。。