我的主要功能反汇编中所有这些奇怪的汇编程序指令是什么?
What is all of these weird assembler instructions on my main function disassembly?
所以我有这个主要功能,它会产生很多奇怪的指令。我正在使用 Visual Studio 2019,并且我处于调试模式,因此禁用了优化。这些指令在做什么?
int main()
{
00D340E0 push ebp
00D340E1 mov ebp,esp
00D340E3 sub esp,104h
00D340E9 push ebx
00D340EA push esi
00D340EB push edi
00D340EC lea edi,[ebp-104h]
00D340F2 mov ecx,41h
00D340F7 mov eax,0CCCCCCCCh
00D340FC rep stos dword ptr es:[edi]
00D340FE mov eax,dword ptr [__security_cookie (0D3A024h)]
00D34103 xor eax,ebp
00D34105 mov dword ptr [ebp-4],eax
00D34108 mov ecx,offset _842A6236_main@cpp (0D3C012h)
00D3410D call @__CheckForDebuggerJustMyCode@4 (0D31208h)
(the rest of the file...)
编辑:奇怪的是,我的意思是我不明白这里发生了什么,并不是说它不标准。
这些是调试助手。
__security_cookie
用于检查堆栈末尾的写入(如果溢出基于堆栈的缓冲区,例如)。真正的检查在退出函数的时候进行。
__CheckForDebuggerJustMyCode
允许调试器跳过 "system, framework, library, and other non-user calls",请参阅 here。
还有这段代码:
lea edi,[ebp-104h]
mov ecx,41h
mov eax,0CCCCCCCCh
rep stos dword ptr es:[edi]
用垃圾字节填充堆栈帧,如果您取消引用未初始化的指针,将(例如)导致异常。
None 这些内容存在于发布版本中,仅存在于调试版本中。
所以我有这个主要功能,它会产生很多奇怪的指令。我正在使用 Visual Studio 2019,并且我处于调试模式,因此禁用了优化。这些指令在做什么?
int main()
{
00D340E0 push ebp
00D340E1 mov ebp,esp
00D340E3 sub esp,104h
00D340E9 push ebx
00D340EA push esi
00D340EB push edi
00D340EC lea edi,[ebp-104h]
00D340F2 mov ecx,41h
00D340F7 mov eax,0CCCCCCCCh
00D340FC rep stos dword ptr es:[edi]
00D340FE mov eax,dword ptr [__security_cookie (0D3A024h)]
00D34103 xor eax,ebp
00D34105 mov dword ptr [ebp-4],eax
00D34108 mov ecx,offset _842A6236_main@cpp (0D3C012h)
00D3410D call @__CheckForDebuggerJustMyCode@4 (0D31208h)
(the rest of the file...)
编辑:奇怪的是,我的意思是我不明白这里发生了什么,并不是说它不标准。
这些是调试助手。
__security_cookie
用于检查堆栈末尾的写入(如果溢出基于堆栈的缓冲区,例如)。真正的检查在退出函数的时候进行。
__CheckForDebuggerJustMyCode
允许调试器跳过 "system, framework, library, and other non-user calls",请参阅 here。
还有这段代码:
lea edi,[ebp-104h]
mov ecx,41h
mov eax,0CCCCCCCCh
rep stos dword ptr es:[edi]
用垃圾字节填充堆栈帧,如果您取消引用未初始化的指针,将(例如)导致异常。
None 这些内容存在于发布版本中,仅存在于调试版本中。