各位大虾:
小弟初学vc++,调试程序时遇到一些问题:我用f10和f11单步调试程序时经常弹出find source窗体,点取消按纽后,出现如下象是汇编的语句,不知该如何处理,请大家不吝赐教.
0042D050 push ebp
0042D051 mov ebp,esp
0042D053 sub esp,8
0042D056 mov dword ptr [ebp-8],ecx
0042D059 cmp dword ptr [_InitFlag (004b2d20)],2
0042D060 jne std::_Lockit::_Lockit+1Fh (0042d06f)
0042D062 push offset _CritSec (004b2d08)
0042D067 call dword ptr [__imp__EnterCriticalSection@4 (004b52f0)]
0042D06D jmp std::_Lockit::_Lockit+99h (0042d0e9)
0042D06F cmp dword ptr [_InitFlag (004b2d20)],0
0042D076 jne std::_Lockit::_Lockit+72h (0042d0c2)
0042D078 push 1
0042D07A push offset _InitFlag (004b2d20)
0042D07F call dword ptr [__imp__InterlockedExchange@8 (004b5394)]
0042D085 mov dword ptr [InitFlagVal],eax
0042D088 cmp dword ptr [InitFlagVal],0
0042D08C jne std::_Lockit::_Lockit+62h (0042d0b2)
0042D08E push offset _CritSec (004b2d08)
0042D093 call dword ptr [__imp__InitializeCriticalSection@4 (004b52d4)]
0042D099 push offset std::_CleanUp (0042d0f0)
0042D09E call atexit (004438f0)
0042D0A3 add esp,4
0042D0A6 mov dword ptr [_InitFlag (004b2d20)],2
0042D0B0 jmp std::_Lockit::_Lockit+72h (0042d0c2)
0042D0B2 cmp dword ptr [InitFlagVal],2
0042D0B6 jne std::_Lockit::_Lockit+72h (0042d0c2)
0042D0B8 mov dword ptr [_InitFlag (004b2d20)],2
0042D0C2 cmp dword ptr [_InitFlag (004b2d20)],1
0042D0C9 jne std::_Lockit::_Lockit+85h (0042d0d5)
0042D0CB push 1
0042D0CD call dword ptr [__imp__Sleep@4 (004b5390)]
0042D0D3 jmp std::_Lockit::_Lockit+72h (0042d0c2)
0042D0D5 cmp dword ptr [_InitFlag (004b2d20)],2
0042D0DC jne std::_Lockit::_Lockit+99h (0042d0e9)
0042D0DE push offset _CritSec (004b2d08)
0042D0E3 call dword ptr [__imp__EnterCriticalSection@4 (004b52f0)]
0042D0E9 mov eax,dword ptr [this]
0042D0EC mov esp,ebp
0042D0EE pop ebp
0042D0EF ret
小弟初学vc++,调试程序时遇到一些问题:我用f10和f11单步调试程序时经常弹出find source窗体,点取消按纽后,出现如下象是汇编的语句,不知该如何处理,请大家不吝赐教.
0042D050 push ebp
0042D051 mov ebp,esp
0042D053 sub esp,8
0042D056 mov dword ptr [ebp-8],ecx
0042D059 cmp dword ptr [_InitFlag (004b2d20)],2
0042D060 jne std::_Lockit::_Lockit+1Fh (0042d06f)
0042D062 push offset _CritSec (004b2d08)
0042D067 call dword ptr [__imp__EnterCriticalSection@4 (004b52f0)]
0042D06D jmp std::_Lockit::_Lockit+99h (0042d0e9)
0042D06F cmp dword ptr [_InitFlag (004b2d20)],0
0042D076 jne std::_Lockit::_Lockit+72h (0042d0c2)
0042D078 push 1
0042D07A push offset _InitFlag (004b2d20)
0042D07F call dword ptr [__imp__InterlockedExchange@8 (004b5394)]
0042D085 mov dword ptr [InitFlagVal],eax
0042D088 cmp dword ptr [InitFlagVal],0
0042D08C jne std::_Lockit::_Lockit+62h (0042d0b2)
0042D08E push offset _CritSec (004b2d08)
0042D093 call dword ptr [__imp__InitializeCriticalSection@4 (004b52d4)]
0042D099 push offset std::_CleanUp (0042d0f0)
0042D09E call atexit (004438f0)
0042D0A3 add esp,4
0042D0A6 mov dword ptr [_InitFlag (004b2d20)],2
0042D0B0 jmp std::_Lockit::_Lockit+72h (0042d0c2)
0042D0B2 cmp dword ptr [InitFlagVal],2
0042D0B6 jne std::_Lockit::_Lockit+72h (0042d0c2)
0042D0B8 mov dword ptr [_InitFlag (004b2d20)],2
0042D0C2 cmp dword ptr [_InitFlag (004b2d20)],1
0042D0C9 jne std::_Lockit::_Lockit+85h (0042d0d5)
0042D0CB push 1
0042D0CD call dword ptr [__imp__Sleep@4 (004b5390)]
0042D0D3 jmp std::_Lockit::_Lockit+72h (0042d0c2)
0042D0D5 cmp dword ptr [_InitFlag (004b2d20)],2
0042D0DC jne std::_Lockit::_Lockit+99h (0042d0e9)
0042D0DE push offset _CritSec (004b2d08)
0042D0E3 call dword ptr [__imp__EnterCriticalSection@4 (004b52f0)]
0042D0E9 mov eax,dword ptr [this]
0042D0EC mov esp,ebp
0042D0EE pop ebp
0042D0EF ret
F11是step into
调用系统函数时候不要按F11,否则它会跟踪到系统函数里面去,但是又没有系统函数的源代码
所以会弹出对话框,让你指定位置,如果取消,系统就会跑到汇编里面去了
e.g.<<windows程序设计>>例程
#include <stdio.h>
#include <windows.h>// 线程函数
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
int i = 0;
while(i < 20)
{
printf(" I am from a thread, count = %d \n", i++);
}
return 0;
}int main(int argc, char* argv[])
{
HANDLE hThread;
DWORD dwThreadId;
// 创建一个线程
hThread = ::CreateThread (
NULL, // 默认安全属性
NULL, // 默认堆栈大小
ThreadProc, // 线程入口地址(执行线程的函数)
NULL, // 传给函数的参数
0, // 指定线程立即运行
&dwThreadId); // 返回线程的ID号
printf(" Now another thread has been created. ID = %d \n", dwThreadId); // 等待新线程运行结束
::WaitForSingleObject (hThread, INFINITE);
::CloseHandle (hThread);
return 0;
}