本文介绍了自定义的prolog/epilog函数进行概要分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Visual Studio编译器中,是否可以编写2个在调用其他函数之前以及在这些函数执行之后被调用的函数?在gcc中,您可以使用__cyg_profile_func_*()
函数来做到这一点:
Is it possible, with Visual Studio compilers, to write 2 functions that get called before calling into other functions and after the functions have executed? In gcc you could do that with __cyg_profile_func_*()
functions:
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位.
I need a solution that works for kernel mode software. I think Microsoft Detours may be of help, but the free edition is 32 bit only and my drivers are pure 64 bit.
我想为特定的生成调用图代码.
I want to generate the call graph for the specific code.
谢谢.
推荐答案
- 您可以使用/Gh /GH 切换cl以创建penter/pexit挂钩.
- 有关免费挂钩API的信息,请查看:
2.1 easyhook
2.2 N-CodeHook
- You can use the /Gh /GH switch of cl to create penter/pexit hooks.
- For free hooking APIs take a look at:
2.1 easyhook
2.2 N-CodeHook
这篇关于自定义的prolog/epilog函数进行概要分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!