【问题标题】:Custom prolog/epilog functions for profiling用于分析的自定义 prolog/epilog 函数
【发布时间】:2010-10-31 06:39:03
【问题描述】:

是否可以使用 Visual Studio 编译器编写 2 个在调用其他函数之前和函数执行之后调用的函数?在 gcc 中,您可以使用 __cyg_profile_func_*() 函数来做到这一点:

void __cyg_profile_func_enter(void *func_address, void *call_site )
                                __attribute__ ((no_instrument_function));

void __cyg_profile_func_exit (void *func_address, void *call_site )
                                __attribute__ ((no_instrument_function));

我需要一个适用于内核模式软件的解决方案。我认为Microsoft Detours 可能会有所帮助,但免费版只有 32 位,而我的驱动程序是纯 64 位的。

我想为特定代码生成call graph

谢谢。

【问题讨论】:

    标签: visual-studio profiling kernel


    【解决方案1】:
    1. 您可以使用 cl 的 /Gh /GH 开关来创建 penter/pexit 挂钩。
    2. 有关免费挂钩 API,请查看:
      2.1 easyhook
      2.2N-CodeHook

    【讨论】:

    • 非常感谢。 /Gh /GH 正是我所需要的。
    猜你喜欢
    • 2010-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多