chapter3.4

it2022-05-09  28

// chapter3.3.cpp : 定义控制台应用程序的入口点。//

#include "stdafx.h"

#include <vector>using std::vector;

int _tmain(int argc, _TCHAR* argv[]){ vector<int> ivec(10);

 for(vector<int>::iterator iter = ivec.begin();iter!=ivec.end();++iter) {  *iter = 0; }  return 0;}

 

debug

od

 

ida

.text:00412260.text:00412260     ; =============== S U B R O U T I N E =======================================.text:00412260.text:00412260     ; Attributes: bp-based frame.text:00412260.text:00412260     _wmain          proc near               ; CODE XREF: j__wmainj.text:00412260.text:00412260     temend2         = dword ptr -130h.text:00412260     temend1         = dword ptr -12Ch.text:00412260     compareresult   = byte ptr -121h.text:00412260     temend          = byte ptr -118h.text:00412260     var_104         = dword ptr -104h.text:00412260     tembegin        = byte ptr -38h.text:00412260     ivec            = byte ptr -24h.text:00412260     nextseh         = dword ptr -0Ch.text:00412260     exceptinlevel   = dword ptr -4.text:00412260.text:00412260 000                 push    ebp.text:00412261 004                 mov     ebp, esp.text:00412263 004                 push    0FFFFFFFFh.text:00412265 008                 push    offset sub_419FFB.text:0041226A 00C                 mov     eax, large fs:0.text:00412270 00C                 push    eax.text:00412271 010                 sub     esp, 124h.text:00412277 134                 push    ebx.text:00412278 138                 push    esi.text:00412279 13C                 push    edi.text:0041227A 140                 lea     edi, [ebp+temend2].text:00412280 140                 mov     ecx, 49h.text:00412285 140                 mov     eax, 0CCCCCCCCh.text:0041228A 140                 rep stosd.text:0041228C 140                 mov     eax, __security_cookie.text:00412291 140                 xor     eax, ebp.text:00412293 140                 push    eax.text:00412294 144                 lea     eax, [ebp+nextseh].text:00412297 144                 mov     large fs:0, eax.text:0041229D 144                 push    0Ah.text:0041229F 148                 lea     ecx, [ebp+ivec].text:004122A2 148                 call    j_??A?$vector@HV?$allocator@H@std@@@std@@QAEAAHI@Z ; std::vector<int,std::allocator<int>>::operator[](uint).text:004122A7 144                 mov     [ebp+exceptinlevel], 0.text:004122AE 144                 lea     eax, [ebp+tembegin].text:004122B1 144                 push    eax.text:004122B2 148                 lea     ecx, [ebp+ivec].text:004122B5 148                 call    j_?begin@?$vector@HV?$allocator@H@std@@@std@@QAE?AV?$_Vector_iterator@HV?$allocator@H@std@@@2@XZ ; std::vector<int,std::allocator<int>>::begin(void).text:004122BA 144                 mov     byte ptr [ebp+exceptinlevel], 1.text:004122BE 144                 jmp     short loc_4122C8.text:004122C0     ; ---------------------------------------------------------------------------.text:004122C0.text:004122C0     loc_4122C0:                             ; CODE XREF: _wmain+CAj.text:004122C0 144                 lea     ecx, [ebp+tembegin].text:004122C3 144                 call    j_??0?$_Vector_const_iterator@HV?$allocator@H@std@@@std@@QAE@ABV01@@Z ; std::_Vector_const_iterator<int,std::allocator<int>>::_Vector_const_iterator<int,std::allocator<int>>(_Vector_const_iterator<int,std::allocator<int>>::_Vector_const_iterator<int,std::allocator<int>> const &).text:004122C8.text:004122C8     loc_4122C8:                             ; CODE XREF: _wmain+5Ej.text:004122C8 144                 lea     eax, [ebp+temend].text:004122CE 144                 push    eax.text:004122CF 148                 lea     ecx, [ebp+ivec].text:004122D2 148                 call    j_?end@?$vector@HV?$allocator@H@std@@@std@@QAE?AV?$_Vector_iterator@HV?$allocator@H@std@@@2@XZ ; std::vector<int,std::allocator<int>>::end(void).text:004122D7 144                 mov     [ebp+temend1], eax.text:004122DD 144                 mov     ecx, [ebp+temend1].text:004122E3 144                 mov     [ebp+temend2], ecx.text:004122E9 144                 mov     byte ptr [ebp+exceptinlevel], 2.text:004122ED 144                 mov     edx, [ebp+temend2].text:004122F3 144                 push    edx.text:004122F4 148                 lea     ecx, [ebp+tembegin].text:004122F7 148                 call    j_??9?$_Vector_const_iterator@HV?$allocator@H@std@@@std@@QBE_NABV01@@Z ; std::_Vector_const_iterator<int,std::allocator<int>>::operator!=(std::_Vector_const_iterator<int,std::allocator<int>> const &).text:004122FC 144                 mov     [ebp+compareresult], al.text:00412302 144                 mov     byte ptr [ebp+exceptinlevel], 1.text:00412306 144                 lea     ecx, [ebp+temend].text:0041230C 144                 call    j_??1?$_Vector_iterator@HV?$allocator@H@std@@@std@@QAE@XZ ; std::_Vector_iterator<int,std::allocator<int>>::~_Vector_iterator<int,std::allocator<int>>(void).text:00412311 144                 movzx   eax, [ebp+compareresult].text:00412318 144                 test    eax, eax.text:0041231A 144                 jz      short release.text:0041231C 144                 lea     ecx, [ebp+tembegin].text:0041231F 144                 call    j_??D?$_Vector_iterator@HV?$allocator@H@std@@@std@@QBEAAHXZ ; std::_Vector_iterator<int,std::allocator<int>>::operator*(void).text:00412324 144                 mov     dword ptr [eax], 0.text:0041232A 144                 jmp     short loc_4122C0.text:0041232C     ; ---------------------------------------------------------------------------.text:0041232C.text:0041232C     release:                                ; CODE XREF: _wmain+BAj.text:0041232C 144                 mov     byte ptr [ebp+exceptinlevel], 0.text:00412330 144                 lea     ecx, [ebp+tembegin].text:00412333 144                 call    j_??1?$_Vector_iterator@HV?$allocator@H@std@@@std@@QAE@XZ ; std::_Vector_iterator<int,std::allocator<int>>::~_Vector_iterator<int,std::allocator<int>>(void).text:00412338 144                 mov     [ebp+var_104], 0.text:00412342 144                 mov     [ebp+exceptinlevel], 0FFFFFFFFh.text:00412349 144                 lea     ecx, [ebp+ivec].text:0041234C 144                 call    j_??1?$vector@HV?$allocator@H@std@@@std@@QAE@XZ ; std::vector<int,std::allocator<int>>::~vector<int,std::allocator<int>>(void).text:00412351 144                 mov     eax, [ebp+var_104].text:00412357 144                 push    edx.text:00412358 148                 mov     ecx, ebp.text:0041235A 148                 push    eax.text:0041235B 14C                 lea     edx, dword_412388.text:00412361 14C                 call    j_@_RTC_CheckStackVars@8 ; _RTC_CheckStackVars(x,x).text:00412366 14C                 pop     eax.text:00412367 148                 pop     edx.text:00412368 144                 mov     ecx, [ebp+nextseh].text:0041236B 144                 mov     large fs:0, ecx.text:00412372 144                 pop     ecx.text:00412373 140                 pop     edi.text:00412374 13C                 pop     esi.text:00412375 138                 pop     ebx.text:00412376 134                 add     esp, 130h.text:0041237C 004                 cmp     ebp, esp.text:0041237E 004                 call    j___RTC_CheckEsp.text:00412383 004                 mov     esp, ebp.text:00412385 004                 pop     ebp.text:00412386 000                 retn.text:00412386     _wmain          endp.text:00412386.text:00412386     ; ---------------------------------------------------------------------------.text:00412387                     align 4

转载于:https://www.cnblogs.com/nanshouyong326/archive/2010/06/21/1761823.html


最新回复(0)