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 ...
随机推荐
- [BZOJ4632]树的编码
[BZOJ4632]树的编码 试题描述 SHUXK 正在对一棵N个结点的有根树进行研究,首要的一件事就是对这棵树进行编码. lz 说:“这还不容易吗?我令根节点的编号为 1,然后保证每个结点的编号都比 ...
- PHP使用CURL上传|下载文件
CURL下载文件 /** * @param string $img_url 下载文件地址 * @param string $save_path 下载文件保存目录 * @param string $fi ...
- MySQL的分页
有朋友问: MySQL的分页似乎一直是个问题,有什么优化方法吗?网上看到网上推荐了一些分页方法,但似乎不太可行,你能点评一下吗? 方法1: 直接使用数据库提供的SQL语句 ---语句样式: MySQL ...
- Linux MySQL 存储引擎详解
MySQL常用的存储引擎为MyISAM.InnoDB.MEMORY.MERGE,其中InnoDB提供事务安全表,其他存储引擎都是非事务安全表. MyISAM是MySQL的默认存储引擎.MyISAM不支 ...
- 数据结构与算法实验题7.1 M 商人的求救
问题描述:A 国正面临着一场残酷的战争,城市被支持不同领导的两股势力占据,作为一个商人,M先生并不太关心政治,但是他知道局势很严重,他希望你能救他出去.M 先生说:“为了安全起见,我们的路线最多只能包 ...
- php远程抓取网站图片并保存
以前看到网上别人说写程序抓取网页图片的,感觉挺神奇,心想什么时候我自己也写一个抓取图片的方法! 刚好这两天没什么事,就参考了网上一个php抓取图片代码,重点借鉴了 匹配img标签和其src属性正则的写 ...
- thinkcentre m8380t黑屏 解决办法
问题: 开机后,显示器上显示“无信号输入”,一直黑屏,但是主机的风扇.硬盘声音都正常. 解决办法: 把vga线等加紧了一些,屏幕还是不亮,然后我关掉插排电源,给cmos放了电,再重启就可以了. 这时需 ...
- JVM调优浅谈
1.数据类型 java虚拟机中,数据类型可以分为两类:基本类型和引用类型.基本类型的变量保存原始值,即:它代表的值就是数值本身,而引用类型的变量保存引用值.“引用值”代表了某个对象的引用,而不是对象本 ...
- selenium启动Chrome时,加载用户配置文件
selenium启动Chrome时,加载用户配置文件 Selenium操作浏览器是不加载任何配置的,网上找了半天,关于Firefox加载配置的多点,Chrome资料很少,下面是关于加载Chrome ...
- iOS 中NSOperationQueue,Grand Central Dispatch , Thread的上下关系和区别
In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central D ...