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. Linux zabbix 配置注意事项

    发现php-fpm启动之后,找不到 php-fpm.pid文件??? vi php-fpm.conf 去掉里面那个 pid = run/php-fpm.pid 前面的分号然后再启动php-fpm才能自 ...

  2. python - PyQuery

    偶尔的机会,知道这么个扩展,手贱翻了下文档,发现似乎挺有意思,遂记录一二. what: 这是一个python版本的jquery,而且是后端执行的,至少官方是这么说的: pyquery allows y ...

  3. jQuery mobile 开发问题记录

    一.动态加载页面问题 1.存在这样一个页面布局: main.html 为主界面A,B为该页面中的三个page,其中A为splitview左部分页面,B为右半部页面 a1.html 为一个独立的页面 a ...

  4. Balanced Binary Tree

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  5. python下的MySQLdb使用

    下载安装MySQLdb <1>linux版本 http://sourceforge.net/projects/mysql-python/ 下载,在安装是要先安装setuptools,然后在 ...

  6. codeforces 489A.SwapSort 解题报告

    题目链接:http://codeforces.com/problemset/problem/489/A 题目意思:给出一个 n 个无序的序列,问能通过两两交换,需要多少次使得整个序列最终呈现非递减形式 ...

  7. emmet中文文档 (转载)

    Emmet的前身是大名鼎鼎的Zen coding,如果你从事Web前端开发的话,对该插件一定不会陌生.它使用仿CSS选择器的语法来生成代码,大大提高了HTML/CSS代码编写的速度,比如下面的演示: ...

  8. centos下安装五笔输入法的教程

    [root@ok ~]# yum update [root@ok ~]# yum install ibus-table-chinese-wubi-haifeng 以上两步已经成功!! #yum ins ...

  9. mongoDb学习以及spring管理

    1.windows下的安装http://www.cnblogs.com/liuzhiying/p/5915741.html 2.慕课网学习单机操作mongoDb 赋权限:http://blog.csd ...

  10. CSS3 background-size 属性值:cover

    当设置值为cover,可以呈现出图片铺满浏览器内容的视觉效果 实例 规定背景图像的尺寸: div { background:url(img_flwr.gif); background-size:80p ...