资 源 简 介
BHook
BHook is a hooking framework for the C/C++ program on Linux platform.
* It can dynamically replace the original function to change the program logic at runtime.
* Supports for replacing any function, including shared library function(such as system function), static library function and program function.
* Provides the default hooking library for system function.
* It can be used for debugging, mocking, testing and so on.
* Baidu C/C++ Mocking Framework is based on the BHook.
Install
$ ./configure --prefix={your install path}$ make$ make install
# Getting Started #
## Use the default hooking library ##
Let the program produce the disk full exception by hooking write function that set errno to ENOSPC(#define ENOSPC 28) with 80% probability:
$ bhook -e write -p 80 -i 28 ./a.out
## User-defined system function ##
1. Source code:
```
//main.cpp
#include