简体   繁体   English

页面分配时的Visual Studio断点

[英]Visual Studio Breakpoint at page allocation

I'm trying to find the cause of an access violation within a library that always seems to occur at a certain page limit (an address like 0x06B12000). 我试图找到一个库中的访问冲突的原因,似乎总是出现在某个页面限制(地址如0x06B12000)。

Now I'm trying to trace the page allocations to find out if the program misses out on some point, but VirtualAlloc only seems to get called a handful of times during program start and not later on. 现在我正在尝试跟踪页面分配,以确定程序是否在某些时候错过了,但VirtualAlloc似乎只是在程序启动期间被调用了几次,而不是稍后。

Am I missing something? 我错过了什么吗?

You can set a breakpoint on malloc via "Break at Function". 您可以通过“Break at Function”在malloc上设置断点。 The Studio comes with some source code for its runtime library so you can debug in there. Studio为其运行时库提供了一些源代码,因此您可以在那里进行调试。

Once you have hit this breakpoint you can add a condition to it to make it only trigger if the returned memory contains the address you are looking for. 一旦达到此断点,就可以为其添加一个条件,使其仅在返回的内存包含您要查找的地址时触发。 Something like (res <= 0x....) && (0x.... < res + nSize) . (res <= 0x....) && (0x.... < res + nSize) This would work for VS2010 debug builds. 这适用于VS2010调试版本。

Release builds are more difficult since some of the local variables are only kept in registers. 由于某些局部变量仅保存在寄存器中,因此版本构建更加困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM