PAD is the userspace application debugger. PAD provides a remote and an in-program probe interfaces to insert the breakpoint before the function is executed.
This project includes two parts, PAD core and libpad. PAD core program allows user to compile the probe program and insert the probe program to the target process. libpad provides the interface for the process, allowing the user to define the traceable function and in-program probe interface.
Build the PAD binaries, core and libpad:
$ make # Build pad core binary
$ make lib # Build libpad
$ make all # Build core and libpad in libpad directory
$ make clean # Delete generated files
DEBUG
: Set1
to enable the debug mode.TEST
: Set 1 to explore the test APIs.ARCH
: The target architecture.static
: Build static library instead of dynamic library.
Currently, x86-64
only.
PAD - the userspace application debugger
Usage: pad [options] file...
Options:
--COMPILER The compiler for building probe program.
--CFLAGS The flag pass to the compiler.
--PROGRAM The file of probe program to compile.
--ENTERPOINT The symbol of the enterpoint for the probe program.
--TARGET_PID The pid of process to probe.
--SYMBOL The symbol of function want to probe.
--ACTION The action of pad <LOAD|UNLOAD|DEBUG>.
--help Display this information.
#include "include/uapi/pad.h"
PAD_ENTER_POINT(breakpoint) { ... }
struct pad_probe {
/* target function */
unsigned long address;
const char *name;
unsigned long breakpoint;
unsigned int flags;
};
int pad_register_probe(struct pad_probe *p);
int pad_unregister_probe(struct pad_probe *p);
/*
* For external (self-defined) handler, PAD_EXTERNAL_HANDLER_FLAG.
* To allow the PAD core insert the breakpoint, PAD_SET_SHMEM_FLAG.
*/
int pad_init(pad_handler_t handler, unsigned int flags);
int pad_exit(void);
Add __pad_trace
attribute to the target function.
static void __pad_trace function(...) { ... }
Add __pad_handler
attribute to the handler function.
static void __pad_handler handler(void) {
...
/* Call all the breakpoints. */
pad_builtin_handler();
}
- double free while the target program failed to handle the signal
- set the prefix of shmem it is located in /dev/shmem
- UNLOAD and DEBUG actions
- eBPF verifier
- handler disable feature (per-thread var)