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的更多相关文章

  1. 黄聪:wordpress获取hook所有function

    list_hooked_functions('wp_footer'); function list_hooked_functions($tag=false) { global $wp_filter; ...

  2. [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 ...

  3. [MetaHook] GameUI hook

    Hook GameUI function. #include <metahook.h> #include <IGameUI.h> IGameUI *g_pGameUI = ; ...

  4. [MetaHook] BaseUI hook

    Hook IBaseUI function. #include <metahook.h> #include <IBaseUI.h> IBaseUI *g_pBaseUI = ; ...

  5. [MetaHook] Surface hook

    Hook ISurface function. #include <metahook.h> #include <vgui/ISurface.h> using namespace ...

  6. Linux LSM(Linux Security Modules) Hook Technology

    目录 . 引言 . Linux Security Module Framework Introduction . LSM Sourcecode Analysis . LSMs Hook Engine: ...

  7. HOOK钩子 - 钩子函数说明

    翻译参考自MaybeHelios的blog: http://blog.csdn.net/maybehelios/ 通过SetWindowsHookEx方法安装钩子,该函数指定处理拦截消息的钩子函数(回 ...

  8. 【Hook技术】实现从"任务管理器"中保护进程不被关闭 + 附带源码 + 进程保护知识扩展

    [Hook技术]实现从"任务管理器"中保护进程不被关闭 + 附带源码 + 进程保护知识扩展 公司有个监控程序涉及到进程的保护问题,需要避免用户通过任务管理器结束掉监控进程,这里使用 ...

  9. 使用fastcall 代替汇编hook thiscall

    利用fastcall中ecx edx传递的特性,解决了ecx需要内嵌汇编才能实现hook thiscall函数的问题. #include <stdio.h> #include <st ...

随机推荐

  1. ubuntu打不开图形界面,显示run in low_graphic mode

    我上次因为这个问题重装了ubuntu,结果没两天又有问题了,这次我看到了未重启前的提示,说我的硬盘空间剩0kb,所以我心有余悸的想办法留空间,十分担心会有上次的问题出现,为了验证我的想法,我重启了一下 ...

  2. 见招拆招:绕过WAF继续SQL注入常用方法

    Web Hacker总是生存在与WAF的不断抗争之中的,厂商不断过滤,Hacker不断绕过.WAF bypass是一个永恒的话题,不少基友也总结了很多奇技怪招.那今天我在这里做个小小的扫盲吧.先来说说 ...

  3. Nmap备忘单:从探索到漏洞利用(Part 4)

    这是我们的Nmap备忘单的第四部分(Part 1. Part 2. Part 3).本文中我们将讨论更多东西关于扫描防火墙,IDS / IPS 逃逸,Web服务器渗透测试等.在此之前,我们应该了解一下 ...

  4. python 之验证码

    验证码原理在于后台自动创建一张带有随机内容的图片,然后将内容通过img标签输出到页面. 安装图像处理模块: pip3 install pillow

  5. 黑客逃避追踪,为什么要用虚拟机 + TOR + VPN 呢?

    为啥要使用虚拟机 使用虚拟机主要有俩原因. 第一个是为了好收拾,清理痕迹什么的.特别是MAC地址,系统指纹信息等等,这些一旦被收集到都可以作为呈堂证供.用虚拟机,干了坏事把快照恢复一下就好,省的清理c ...

  6. PHP 逻辑思维题

    约瑟夫环 一群猴子排成一圈,按1,2,...,n依次编号.然后从第1只开始数,数到第m只,把它踢出圈,从它后面再开始数,再数到第m只,在把它踢出去...,如此不停的进行下去,直到最后只剩下一只猴子为止 ...

  7. 54. 八皇后问题[eight queens puzzle]

    [本文链接] http://www.cnblogs.com/hellogiser/p/eight-queens-puzzle.html [题目] 在8×8的国际象棋上摆放八个皇后,使其不能相互攻击,即 ...

  8. (转)SQL Server 的事务和锁(二)-Range S-S锁

    在这篇随笔中,我们的主要关注点在 Key-Range Lock.Key-Range Lock有 S-S.S-U.I-N.X-X几种情况.我们一个一个来说,力求明白.遗憾的是,这里可能会比较冗长,那么死 ...

  9. codeforces A. Flipping Game 解题报告

    题目链接:http://codeforces.com/problemset/problem/327/A 题意是输入一个只有0和1的序列,要求找出一个合理的区间,在这个区间里面把0变成1,1变成0,使得 ...

  10. Mac OS Ruby安装 使用RVM

    访问http://www.ruby-lang.org/en/downloads/ 使用第三方工具安装ruby,经过了解,在mac下可以使用macports和rvm安装ruby. 经过实际操作觉得rvm ...