调试Visual C ++内存分配问题 [英] Debug Visual C++ memory allocation problems
问题描述
我正在调试一个最终会因以下消息之一而崩溃的软件:
I'm debugging a software which crashes eventually with one of the following messages:
1. DAMAGE: after normal block (#24729280) at 0x00D710E0
2. Debug Assertion Failed
Program: D:\Soft\Test.exe
File: dbgheap.c
Line: 1017
Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse)
该软件确实很旧,但现在不能更改.它是在Visual C ++ 6.0上编写的.我们猜测这是某种缓冲区溢出,因此我们试图找到方法来检测它的发生位置.
This software is really old but changing it now is not an option. It's written on Visual C++ 6.0. We are guessing it's some kind of buffer overflow, so we are trying to find ways to detect where it is happening.
我找到了有关 PageHeap 的信息(似乎可以告诉我我想要的)和 GFlags ,但看来我无法使其正常工作.
I have found information about PageHeap (which seems to be able to tell me what I want) and GFlags, but it seems I can't make it work.
我创建了一个测试程序:
I created a test program:
char* test;
test = new char[5];
test[5] = 'a';
delete[] test;
这会引发错误:
DAMAGE: after normal block (#55) at 0x1671920
然后,我尝试通过运行以下命令将PageHeap附加到它:
Then, I tried attaching PageHeap to it by running:
gflags.exe /p /enable MemoryTest.exe /full
,然后重新运行它(通过Visual C ++ 6.0界面和Windows资源管理器),导致相同的错误.
and then rerunning it (both through Visual C++ 6.0 interface and through the windows explorer), which resulted on the same error.
然后我尝试编译发行版本,并通过Visual C ++ 6.0界面运行它以获取错误:
Then I tried to compile the release version, and ran it through the Visual C++ 6.0 interface to get the error:
User breakpoint called from code at 0x7c90120e
然后从Windows资源管理器中,我得到了Windows对话框,要求我发送错误报告.
And from the windows explorer, I just got the windows dialog asking me to send an error report.
我想念什么?