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 ...
随机推荐
- IOS 使用横屏
http://lizhuang.iteye.com/blog/1684881 在iPad应用开发时如何让设备只支持横屏(landscape)模式,我做了多次尝试,并没有发现比较简捷的设置方法.我尝试了 ...
- [UOJ#131][BZOJ4199][NOI2015]品酒大会 后缀数组 + 并查集
[UOJ#131][BZOJ4199][NOI2015]品酒大会 试题描述 一年一度的“幻影阁夏日品酒大会”隆重开幕了.大会包含品尝和趣味挑战两个环节,分别向优胜者颁发“首席品酒家”和“首席猎手”两个 ...
- Coursera台大机器学习课程笔记9 -- Logistic Regression
如果只想得到某种概率,而不是简单的分类,那么该如何做呢?在误差衡量问题上,如何选取误差函数这段很有意思. 接下来是如何最小化Ein,由于Ein是可凸优化的,所以采用的是梯度下降法:只要达到谷底,就找到 ...
- MySQL使用索引的场景及真正利用索引的SQL类型
1. 为什么使用索引 在无索引的情况下,MySQL会扫描整张表来查找符合sql条件的记录,其时间开销与表中数据量呈正相关.对关系型数据表中的某些字段建索引可以极大提高查询速度(当然,不同字段是否sel ...
- TestPointer
C++ Code 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 ...
- HAST 使用笔记
1.环境 2台 freebsd 9.2的机器,/home分区为260G,需要将其转为hast块设备 2.安装 (1)先umount /home,然后注释掉/etc/fstab上的/home记录: # ...
- 【转】windows下安装和调用curl的方法
本文转自:http://1316478764.iteye.com/blog/2100778 curl是利用URL语法在命令行方式下工作的开源文件传输工具.它支持很多协议:FTP, FTPS, HTTP ...
- Android开发数据库三层应用-DataSnap
Android开发数据库三层应用-DataSnap http://www.2ccc.com/news/Html/?1517.html 核心提示:我觉得Delphi最强大的的功能之一就是开发数据库三层应 ...
- BestCoder12 1001.So easy(hdu 5058) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5058 (格式有点问题,为了方便阅读---整个复制下来吧) 题目意思:给出两个长度都为 n 的集合你,问 ...
- codeforces C. Vasily the Bear and Sequence 解题报告
题目链接:http://codeforces.com/problemset/problem/336/C 题目意思:给出一个递增的正整数序列 a1, a2, ..., an,要求从中选出一堆数b1, b ...