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. 把 表拷贝到test测试数据库

    (文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) bundle exec rake db:schema:load RAILS_ENV=test   注 ...

  2. [BZOJ4636]蒟蒻的数列

    [BZOJ4636]蒟蒻的数列 试题描述 蒟蒻DCrusher不仅喜欢玩扑克,还喜欢研究数列 题目描述 DCrusher有一个数列,初始值均为0,他进行N次操作,每次将数列[a,b)这个区间中所有比k ...

  3. 使用HTML5 Web存储的localStorage和sessionStorage方式

    localStorage(本地存储),可以长期存储数据,没有时间限制,一天,一年,两年甚至更长,数据都可以使用.sessionStorage(会话存储),只有在浏览器被关闭之前使用,创建另一个页面时同 ...

  4. django admin 扩展

    添加自定义动作: 例子,添加一个方法,批量更新文章,代码如下: from django.contrib import admin from myapp.models import Article de ...

  5. Python的getattr()

    Python的getattr(),setattr(),delattr(),hasattr() getattr()函数是Python自省的核心函数,具体使用大体如下: 获取对象引用getattrGeta ...

  6. jQuery Ajax 操作函数

    jQuery Ajax 操作函数 jQuery 库拥有完整的 Ajax 兼容套件.其中的函数和方法允许我们在不刷新浏览器的情况下从服务器加载数据. 函数 描述 jQuery.ajax() 执行异步 H ...

  7. hadoop(一):深度剖析hdfs原理

    在配置hbase集群将 hdfs 挂接到其它镜像盘时,有不少困惑的地方,结合以前的资料再次学习;  大数据底层技术的三大基石起源于Google在2006年之前的三篇论文GFS.Map-Reduce. ...

  8. iOS 中的Certificate,Provisioning Profile 等在code singing中用到的信息

    注册apple id 有1年多了,这些概念还是模模糊糊的,决定在这里总结一下. 请参阅官方文档 App Distribution Guide code singing的作用如下: Code signi ...

  9. codeforces A. Domino 解题报告

    题目链接:http://codeforces.com/problemset/problem/353/A 题目意思:通俗地说,就是当上下两半的数的总和不完全是偶数时,通过上下调换某些骨牌来使这两半的数和 ...

  10. ubuntu 13.10 amd64安装ia32-libs

    很多软件只有32位的,有的依赖32位库还挺严重的:从ubuntu 13.10已经废弃了ia32-libs,但可以使用多架构,安装软件或包apt-get install program:i386.有的还 ...