Hook to function
myFun.h
1: #include <stdio.h>
2:
3: void __cyg_profile_func_enter(void *this_fn, void *call_site)
4: __attribute__((no_instrument_function));
5: void __cyg_profile_func_enter(void *this_fn, void *call_site) {
6: printf("Hello I am entering\n");
7: } /* __cyg_profile_func_enter */
8: void __cyg_profile_func_exit(void *this_fn, void *call_site)
9: __attribute__((no_instrument_function));
10: void __cyg_profile_func_exit(void *this_fn, void *call_site) {
11: printf("Hello, I am exitint\n");
12: } /* __cyg_profile_func_enter */
13:
main.c
1: #include <stdio.h>
2: #include "myfun.h"
3: void myStartupFun (void) __attribute__ ((constructor));
4: void myCleanupFun (void) __attribute__ ((destructor));
5: int foo() {
6: return 2;
7: }
8: int bar() {
9: return 1;
10: }
11: int main(int argc, char** argv) {
12: int i ,j;
13: i = foo();
14: j = bar();
15: printf("foo=%d bar=%d\n", i, j);
16: return 0;
17: }
when you compile this file, please put the myFun.h in the same directory with main.c, and MUST with flag “-finstrument-functions”
Hook to function的更多相关文章
- 黄聪:wordpress获取hook所有function
list_hooked_functions('wp_footer'); function list_hooked_functions($tag=false) { global $wp_filter; ...
- [React] Use the React Effect Hook in Function Components
Similar to the State Hook, the Effect Hook is “first-class” in React and handy for performing side e ...
- [MetaHook] GameUI hook
Hook GameUI function. #include <metahook.h> #include <IGameUI.h> IGameUI *g_pGameUI = ; ...
- [MetaHook] BaseUI hook
Hook IBaseUI function. #include <metahook.h> #include <IBaseUI.h> IBaseUI *g_pBaseUI = ; ...
- [MetaHook] Surface hook
Hook ISurface function. #include <metahook.h> #include <vgui/ISurface.h> using namespace ...
- Linux LSM(Linux Security Modules) Hook Technology
目录 . 引言 . Linux Security Module Framework Introduction . LSM Sourcecode Analysis . LSMs Hook Engine: ...
- HOOK钩子 - 钩子函数说明
翻译参考自MaybeHelios的blog: http://blog.csdn.net/maybehelios/ 通过SetWindowsHookEx方法安装钩子,该函数指定处理拦截消息的钩子函数(回 ...
- 【Hook技术】实现从"任务管理器"中保护进程不被关闭 + 附带源码 + 进程保护知识扩展
[Hook技术]实现从"任务管理器"中保护进程不被关闭 + 附带源码 + 进程保护知识扩展 公司有个监控程序涉及到进程的保护问题,需要避免用户通过任务管理器结束掉监控进程,这里使用 ...
- 使用fastcall 代替汇编hook thiscall
利用fastcall中ecx edx传递的特性,解决了ecx需要内嵌汇编才能实现hook thiscall函数的问题. #include <stdio.h> #include <st ...
随机推荐
- ruby开发过程中的小总结
(1)建表的时候注意保留字 在新建的表里无法插入一列的值, 报错信息是:Can't mass-assign protected attributes,这一列的列名是type,查了一下发现是因为type ...
- [BZOJ4530][Bjoi2014]大融合 LCT + 启发式合并
[BZOJ4530][Bjoi2014]大融合 试题描述 小强要在N个孤立的星球上建立起一套通信系统.这套通信系统就是连接N个点的一个树. 这个树的边是一条一条添加上去的.在某个时刻,一条边的负载就是 ...
- PHP使用CURL上传|下载文件
CURL下载文件 /** * @param string $img_url 下载文件地址 * @param string $save_path 下载文件保存目录 * @param string $fi ...
- hdu1151 二分图(无回路有向图)的最小路径覆盖 Air Raid
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励) Air Raid Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65 ...
- Android Studio "diamond operator is not supported" 处理方法
低版本的android编译环境是不支持使用java7语法的,如果使用了,就会产生上述问题,如果你的android环境较新,那么可以使用以下方法: 在build.gradle的android标签下加入以 ...
- UBUNTU中如何获得root权限
在终端中输入: sudo passwd root Enter new UNIX password: (在这输入你的密码) Retype new UNIX password: (确定你输入的密码) pa ...
- HDU1009老鼠的旅行 (贪心算法)
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- CodeForces - 424B (贪心算法)
Megacity Time Limit: 2000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Sta ...
- JDK安装和配置
一.Windows下的JDK环境变量配置 在java 中需要设置三个环境变量(1.5之后不用再设置classpath了,但个人强烈建议继续设置以保证向下兼用问题) JDK安装完成之后我们来设置环境变量 ...
- [Java基础] System.arraycopy使用
转载自:http://blog.csdn.net/java2000_net/article/details/4059465 System提供了一个native 静态方法arraycopy(),我们可以 ...