在vs2005下建立vc++的win32 控制台应用程序,设置stdafx.h不必要包含,设置多字符集,设置汇编输出/FAs。代码和asm解析如下:
#include <stdio.h>
static int randSeed = 0;
void srand_test(int seed)
{
randSeed = seed;
}
int rand_test(void)
{
randSeed = (69069 * randSeed + 1);
return randSeed & 0x7fff;
}
struct X
{
int i,j;
X()
{
i = rand_test();
j = rand_test();
}
};
struct Range_error
{
enum{Range_error_string_size = 2048};
int i, max;
Range_error(int t, int tm):i(t), max(tm){}
char *get_message()
{
static char cT[Range_error_string_size];
sprintf(cT, "range error:i(%d) >= max(%d)", i, max);
return cT;
}
};
struct XXX
{
enum{X_arr_size = 10};
X& operator[](int i)
{
if(i >=0 && i < X_arr_size)
return p[i];
else
throw Range_error(i, X_arr_size);
}
XXX()
{
p = new X[X_arr_size];
}
~XXX()
{
delete []p;
}
private:
X *p;
};
int main(int argc, char* argv[])
{
try
{
XXX t;
printf("X.i(%d) j(%d)/n", t[2].i, t[2].j);
printf("X.i(%d) j(%d)/n", t[rand_test()].i, t[rand_test()].j);
}
catch(Range_error e)
{
printf("error:%s/n", e.get_message());
}
catch(...)
{
printf("error .../n");
}
getchar();
return 0;
}
_BSS SEGMENT
_randSeed DD 01H DUP (?)
_BSS ENDS
PUBLIC ?srand_test@@YAXH@Z ; srand_test
_TEXT SEGMENT
_seed$ = 8 ; size = 4
?srand_test@@YAXH@Z PROC ; srand_test, COMDAT
; 4 : {
push ebp
mov ebp, esp
sub esp, 192 ; 000000c0H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-192]
mov ecx, 48 ; 00000030H
mov eax, -858993460 ; ccccccccH
rep stosd
; 5 : randSeed = seed;
mov eax, DWORD PTR _seed$[ebp]
mov DWORD PTR _randSeed, eax
; 6 : }
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
?srand_test@@YAXH@Z ENDP ; srand_test
_TEXT ENDS
PUBLIC ?rand_test@@YAHXZ ; rand_test
; Function compile flags: /Odtp /RTCsu /ZI
; COMDAT ?rand_test@@YAHXZ
_TEXT SEGMENT
?rand_test@@YAHXZ PROC ; rand_test, COMDAT
; 8 : {
push ebp
mov ebp, esp
sub esp, 192 ; 000000c0H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-192]
mov ecx, 48 ; 00000030H
mov eax, -858993460 ; ccccccccH
rep stosd
; 9 : randSeed = (69069 * randSeed + 1);
mov eax, DWORD PTR _randSeed
imul eax, 69069 ; 00010dcdH
add eax, 1
mov DWORD PTR _randSeed, eax
; 10 : return randSeed & 0x7fff;
mov eax, DWORD PTR _randSeed
and eax, 32767 ; 00007fffH
; 11 : }
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
?rand_test@@YAHXZ ENDP ; rand_test
_TEXT ENDS
PUBLIC ??_H@YGXPAXIHP6EPAX0@Z@Z ; `vector constructor iterator'
EXTRN __RTC_CheckEsp:PROC
; Function compile flags: /Odtp /RTCsu /ZI
; COMDAT ??_H@YGXPAXIHP6EPAX0@Z@Z
_TEXT SEGMENT
___t$ = 8 ; size = 4
___s$ = 12 ; size = 4
___n$ = 16 ; size = 4
___f$ = 20 ; size = 4
??_H@YGXPAXIHP6EPAX0@Z@Z PROC ; `vector constructor iterator', COMDAT
push ebp
mov ebp, esp
sub esp, 192 ; 000000c0H
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-192]
mov ecx, 48 ; 00000030H
mov eax, -858993460 ; ccccccccH
rep stosd
$LN2@vector:
mov eax, DWORD PTR ___n$[ebp]
sub eax, 1
mov DWORD PTR ___n$[ebp], eax
js SHORT $LN3@vector
mov esi, esp
mov ecx, DWORD PTR ___t$[ebp]
call DWORD PTR ___f$[ebp]
cmp esi, esp
call __RTC_CheckEsp
mov eax, DWORD PTR ___t$[ebp]
add eax, DWORD PTR ___s$[ebp]
mov DWORD PTR ___t$[ebp], eax
jmp SHORT $LN2@vector
$LN3@vector:
pop edi
pop esi
pop ebx
add esp, 192 ; 000000c0H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 16 ; 00000010H
??_H@YGXPAXIHP6EPAX0@Z@Z ENDP ; `vector constructor iterator'
_TEXT ENDS
PUBLIC ??_C@_0L@BKKCHGLE@error?5?4?4?4?6?$AA@ ; `string'
PUBLIC ??_C@_09PAKKHEGN@error?3?$CFs?6?$AA@ ; `string'
PUBLIC ?get_message@Range_error@@QAEPADXZ ; Range_error::get_message
PUBLIC ??1XXX@@QAE@XZ ; XXX::~XXX
PUBLIC ??_C@_0P@LEFEJEEB@X?4i?$CI?$CFd?$CJ?5j?$CI?$CFd?$CJ?6?$AA@ ; `string'
PUBLIC ??AXXX@@QAEAAUX@@H@Z ; XXX::operator[]
PUBLIC ??0XXX@@QAE@XZ ; XXX::XXX
PUBLIC _main
PUBLIC ??_R0?AURange_error@@@8 ; Range_error `RTTI Type Descriptor'
EXTRN __imp__getchar:PROC
EXTRN __imp__printf:PROC
EXTRN ___security_cookie:DWORD
EXTRN ___CxxFrameHandler3:PROC
EXTRN @__security_check_cookie@4:PROC
EXTRN @_RTC_CheckStackVars@8:PROC
EXTRN ??_7type_info@@6B@:QWORD ; type_info::`vftable'
; COMDAT ??_R0?AURange_error@@@8
_DATA SEGMENT
??_R0?AURange_error@@@8 DD FLAT:??_7type_info@@6B@ ; Range_error `RTTI Type Descriptor'
DD 00H
DB '.?AURange_error@@', 00H
_DATA ENDS
; COMDAT ??_C@_0L@BKKCHGLE@error?5?4?4?4?6?$AA@
CONST SEGMENT
??_C@_0L@BKKCHGLE@error?5?4?4?4?6?$AA@ DB 'error ...', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09PAKKHEGN@error?3?$CFs?6?$AA@
CONST SEGMENT
??_C@_09PAKKHEGN@error?3?$CFs?6?$AA@ DB 'error:%s', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0P@LEFEJEEB@X?4i?$CI?$CFd?$CJ?5j?$CI?$CFd?$CJ?6?$AA@
CONST SEGMENT
??_C@_0P@LEFEJEEB@X?4i?$CI?$CFd?$CJ?5j?$CI?$CFd?$CJ?6?$AA@ DB 'X.i(%d) j('
DB '%d)', 0aH, 00H ; `string'
CONST ENDS
; COMDAT xdata$x
xdata$x SEGMENT
__tryblocktable$_main DD 00H
DD 01H
DD 02H
DD 02H
DD FLAT:__catchsym$_main$4
__unwindtable$_main DD 0ffffffffH
DD 00H
DD 00H
DD FLAT:__unwindfunclet$_main$3
DD 0ffffffffH
DD 00H
__catchsym$_main$4 DD 00H
DD FLAT:??_R0?AURange_error@@@8
DD 0ffffffd8H
DD FLAT:__catch$_main$0
DD 040H
DD 00H
DD 00H
DD FLAT:__catch$_main$1
__ehfuncinfo$_main DD 019930522H
DD 03H
DD FLAT:__unwindtable$_main
DD 01H
DD FLAT:__tryblocktable$_main
DD 2 DUP(00H)
DD 00H
DD 01H
; Function compile flags: /Odtp /RTCsu /ZI
xdata$x ENDS
; COMDAT _main
_TEXT SEGMENT
tv135 = -252 ; size = 4
tv134 = -248 ; size = 4
tv133 = -244 ; size = 4
tv131 = -244 ; size = 4
tv132 = -240 ; size = 4
tv130 = -240 ; size = 4
tv129 = -240 ; size = 4
_e$3763 = -40 ; size = 8
_t$3761 = -24 ; size = 4
__$EHRec$ = -16 ; size = 16
_argc$ = 8 ; size = 4
_argv$ = 12 ; size = 4
_main PROC ; COMDAT
; 55 : {
push ebp
mov ebp, esp
push -1
push __ehhandler$_main
mov eax, DWORD PTR fs:0
push eax
push ecx
sub esp, 236 ; 000000ecH
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-252]
mov ecx, 59 ; 0000003bH
mov eax, -858993460 ; ccccccccH
rep stosd
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
push eax
lea eax, DWORD PTR __$EHRec$[ebp+4]
mov DWORD PTR fs:0, eax
mov DWORD PTR __$EHRec$[ebp], esp
; 56 : try
; 57 : {
mov DWORD PTR __$EHRec$[ebp+12], 0
; 58 : XXX t;
lea ecx, DWORD PTR _t$3761[ebp]
call ??0XXX@@QAE@XZ ; XXX::XXX
mov DWORD PTR tv129[ebp], eax
mov BYTE PTR __$EHRec$[ebp+12], 1
; 59 : printf("X.i(%d) j(%d)/n", t[2].i, t[2].j);
push 2
lea ecx, DWORD PTR _t$3761[ebp]
call ??AXXX@@QAEAAUX@@H@Z ; XXX::operator[]
mov DWORD PTR tv130[ebp], eax
push 2
lea ecx, DWORD PTR _t$3761[ebp]
call ??AXXX@@QAEAAUX@@H@Z ; XXX::operator[]
mov DWORD PTR tv131[ebp], eax
mov esi, esp
mov eax, DWORD PTR tv130[ebp]
mov ecx, DWORD PTR [eax+4]
push ecx
mov edx, DWORD PTR tv131[ebp]
mov eax, DWORD PTR [edx]
push eax
push OFFSET ??_C@_0P@LEFEJEEB@X?4i?$CI?$CFd?$CJ?5j?$CI?$CFd?$CJ?6?$AA@
call DWORD PTR __imp__printf
add esp, 12 ; 0000000cH
cmp esi, esp
call __RTC_CheckEsp
; 60 : printf("X.i(%d) j(%d)/n", t[rand_test()].i, t[rand_test()].j);
call ?rand_test@@YAHXZ ; rand_test
mov DWORD PTR tv132[ebp], eax
mov eax, DWORD PTR tv132[ebp]
push eax
lea ecx, DWORD PTR _t$3761[ebp]
call ??AXXX@@QAEAAUX@@H@Z ; XXX::operator[]
mov DWORD PTR tv133[ebp], eax
call ?rand_test@@YAHXZ ; rand_test
mov DWORD PTR tv134[ebp], eax
mov ecx, DWORD PTR tv134[ebp]
push ecx
lea ecx, DWORD PTR _t$3761[ebp]
call ??AXXX@@QAEAAUX@@H@Z ; XXX::operator[]
mov DWORD PTR tv135[ebp], eax
mov esi, esp
mov edx, DWORD PTR tv133[ebp]
mov eax, DWORD PTR [edx+4]
push eax
mov ecx, DWORD PTR tv135[ebp]
mov edx, DWORD PTR [ecx]
push edx
push OFFSET ??_C@_0P@LEFEJEEB@X?4i?$CI?$CFd?$CJ?5j?$CI?$CFd?$CJ?6?$AA@
call DWORD PTR __imp__printf
add esp, 12 ; 0000000cH
cmp esi, esp
call __RTC_CheckEsp
; 61 : }
mov BYTE PTR __$EHRec$[ebp+12], 0
lea ecx, DWORD PTR _t$3761[ebp]
call ??1XXX@@QAE@XZ ; XXX::~XXX
jmp SHORT $LN4@main
__catch$_main$0:
; 62 : catch(Range_error e)
; 63 : {
; 64 : printf("error:%s/n", e.get_message());
lea ecx, DWORD PTR _e$3763[ebp];异常处理代码会根据异常类型动态地调转到此处
call ?get_message@Range_error@@QAEPADXZ ; Range_error::get_message
mov esi, esp
push eax
push OFFSET ??_C@_09PAKKHEGN@error?3?$CFs?6?$AA@
call DWORD PTR __imp__printf
add esp, 8
cmp esi, esp
call __RTC_CheckEsp
; 65 : }
mov eax, __tryend$_main$2
ret 0
__catch$_main$1:
; 66 : catch(...)
; 67 : {
; 68 : printf("error .../n");
mov esi, esp
push OFFSET ??_C@_0L@BKKCHGLE@error?5?4?4?4?6?$AA@
call DWORD PTR __imp__printf
add esp, 4
cmp esi, esp
call __RTC_CheckEsp
; 69 : }
mov eax, __tryend$_main$2
ret 0
$LN4@main:
; 65 : }
mov DWORD PTR __$EHRec$[ebp+12], -1
__tryend$_main$2:
; 70 : getchar();
mov esi, esp
call DWORD PTR __imp__getchar
cmp esi, esp
call __RTC_CheckEsp
; 71 : return 0;
xor eax, eax
; 72 : }
push edx
mov ecx, ebp
push eax
lea edx, DWORD PTR $LN16@main
call @_RTC_CheckStackVars@8
pop eax
pop edx
mov ecx, DWORD PTR __$EHRec$[ebp+4]
mov DWORD PTR fs:0, ecx
pop ecx
pop edi
pop esi
pop ebx
add esp, 252 ; 000000fcH
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
npad 1
$LN16@main:
DD 2
DD $LN15@main
$LN15@main:
DD -24 ; ffffffe8H
DD 4
DD $LN12@main
DD -40 ; ffffffd8H
DD 8
DD $LN13@main
$LN13@main:
DB 101 ; 00000065H
DB 0
$LN12@main:
DB 116 ; 00000074H
DB 0
_TEXT ENDS
; COMDAT text$x
text$x SEGMENT
__unwindfunclet$_main$3:
lea ecx, DWORD PTR _t$3761[ebp]
jmp ??1XXX@@QAE@XZ ; XXX::~XXX
__ehhandler$_main:
mov edx, DWORD PTR [esp+8]
lea eax, DWORD PTR [edx+12]
mov ecx, DWORD PTR [edx-256]
xor ecx, eax
call @__security_check_cookie@4
mov eax, OFFSET __ehfuncinfo$_main
jmp ___CxxFrameHandler3
text$x ENDS
_main ENDP
PUBLIC ?cT@?1??get_message@Range_error@@QAEPADXZ@4PADA ; `Range_error::get_message'::`2'::cT
PUBLIC ??_C@_0BN@EAOFHIIM@range?5error?3i?$CI?$CFd?$CJ?5?$DO?$DN?5max?$CI?$CFd?$CJ?$AA@ ; `string'
EXTRN __imp__sprintf:PROC
; COMDAT ?cT@?1??get_message@Range_error@@QAEPADXZ@4PADA
_BSS SEGMENT
?cT@?1??get_message@Range_error@@QAEPADXZ@4PADA DB 0800H DUP (?) ; `Range_error::get_message'::`2'::cT
_BSS ENDS
; COMDAT ??_C@_0BN@EAOFHIIM@range?5error?3i?$CI?$CFd?$CJ?5?$DO?$DN?5max?$CI?$CFd?$CJ?$AA@
CONST SEGMENT
??_C@_0BN@EAOFHIIM@range?5error?3i?$CI?$CFd?$CJ?5?$DO?$DN?5max?$CI?$CFd?$CJ?$AA@ DB 'r'
DB 'ange error:i(%d) >= max(%d)', 00H ; `string'
; Function compile flags: /Odtp /RTCsu /ZI
CONST ENDS
; COMDAT ?get_message@Range_error@@QAEPADXZ
_TEXT SEGMENT
_this$ = -8 ; size = 4
?get_message@Range_error@@QAEPADXZ PROC ; Range_error::get_message, COMDAT
; _this$ = ecx
; 27 : {
push ebp
mov ebp, esp
sub esp, 204 ; 000000ccH
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-204]
mov ecx, 51 ; 00000033H
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov DWORD PTR _this$[ebp], ecx
; 28 : static char cT[Range_error_string_size];
; 29 : sprintf(cT, "range error:i(%d) >= max(%d)", i, max);
mov esi, esp
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR [eax+4]
push ecx
mov edx, DWORD PTR _this$[ebp]
mov eax, DWORD PTR [edx]
push eax
push OFFSET ??_C@_0BN@EAOFHIIM@range?5error?3i?$CI?$CFd?$CJ?5?$DO?$DN?5max?$CI?$CFd?$CJ?$AA@
push OFFSET ?cT@?1??get_message@Range_error@@QAEPADXZ@4PADA ; `Range_error::get_message'::`2'::cT
call DWORD PTR __imp__sprintf
add esp, 16 ; 00000010H
cmp esi, esp
call __RTC_CheckEsp
; 30 : return cT;
mov eax, OFFSET ?cT@?1??get_message@Range_error@@QAEPADXZ@4PADA ; `Range_error::get_message'::`2'::cT
; 31 : }
pop edi
pop esi
pop ebx
add esp, 204 ; 000000ccH
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
?get_message@Range_error@@QAEPADXZ ENDP ; Range_error::get_message
_TEXT ENDS
PUBLIC __TI1?AURange_error@@
PUBLIC ??0Range_error@@QAE@HH@Z ; Range_error::Range_error
PUBLIC __CTA1?AURange_error@@
PUBLIC __CT??_R0?AURange_error@@@88
EXTRN __CxxThrowException@8:PROC
; COMDAT __CT??_R0?AURange_error@@@88
xdata$x SEGMENT
__CT??_R0?AURange_error@@@88 DD 00H
DD FLAT:??_R0?AURange_error@@@8
DD 00H
DD 0ffffffffH
ORG $+4
DD 08H
DD 00H
xdata$x ENDS
; COMDAT __CTA1?AURange_error@@
xdata$x SEGMENT
__CTA1?AURange_error@@ DD 01H
DD FLAT:__CT??_R0?AURange_error@@@88
xdata$x ENDS
; COMDAT __TI1?AURange_error@@
xdata$x SEGMENT
__TI1?AURange_error@@ DD 00H
DD 00H
DD 00H
DD FLAT:__CTA1?AURange_error@@
; Function compile flags: /Odtp /RTCsu /ZI
xdata$x ENDS
; COMDAT ??AXXX@@QAEAAUX@@H@Z
_TEXT SEGMENT
$T3845 = -232 ; size = 8
$T3846 = -216 ; size = 8
_this$ = -8 ; size = 4
_i$ = 8 ; size = 4
??AXXX@@QAEAAUX@@H@Z PROC ; XXX::operator[], COMDAT
; _this$ = ecx
; 37 : {
push ebp
mov ebp, esp
sub esp, 236 ; 000000ecH
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-236]
mov ecx, 59 ; 0000003bH
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov DWORD PTR _this$[ebp], ecx
; 38 : if(i >=0 && i < X_arr_size)
cmp DWORD PTR _i$[ebp], 0
jl SHORT $LN2@operator
cmp DWORD PTR _i$[ebp], 10 ; 0000000aH
jge SHORT $LN2@operator
; 39 : return p[i];
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR [eax]
mov edx, DWORD PTR _i$[ebp]
lea eax, DWORD PTR [ecx+edx*8]
jmp SHORT $LN4@operator
; 40 : else
jmp SHORT $LN4@operator
$LN2@operator:
; 41 : throw Range_error(i, X_arr_size);
push 10 ; 0000000aH
mov eax, DWORD PTR _i$[ebp]
push eax
lea ecx, DWORD PTR $T3846[ebp]
call ??0Range_error@@QAE@HH@Z ; Range_error::Range_error
mov ecx, DWORD PTR [eax]
mov edx, DWORD PTR [eax+4]
mov DWORD PTR $T3845[ebp], ecx
mov DWORD PTR $T3845[ebp+4], edx
push OFFSET __TI1?AURange_error@@
lea eax, DWORD PTR $T3845[ebp]
push eax
call __CxxThrowException@8;调转到异常处理流程,后面就是系统代码了
$LN4@operator:
; 42 : }
pop edi
pop esi
pop ebx
add esp, 236 ; 000000ecH
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 4
??AXXX@@QAEAAUX@@H@Z ENDP ; XXX::operator[]
; Function compile flags: /Odtp /RTCsu /ZI
_TEXT ENDS
; COMDAT ??0Range_error@@QAE@HH@Z
_TEXT SEGMENT
_this$ = -8 ; size = 4
_t$ = 8 ; size = 4
_tm$ = 12 ; size = 4
??0Range_error@@QAE@HH@Z PROC ; Range_error::Range_error, COMDAT
; _this$ = ecx
; 25 : Range_error(int t, int tm):i(t), max(tm){}
push ebp
mov ebp, esp
sub esp, 204 ; 000000ccH
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-204]
mov ecx, 51 ; 00000033H
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov DWORD PTR _this$[ebp], ecx
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR _t$[ebp]
mov DWORD PTR [eax], ecx
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR _tm$[ebp]
mov DWORD PTR [eax+4], ecx
mov eax, DWORD PTR _this$[ebp]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
??0Range_error@@QAE@HH@Z ENDP ; Range_error::Range_error
_TEXT ENDS
PUBLIC ??0X@@QAE@XZ ; X::X
EXTRN ??3@YAXPAX@Z:PROC ; operator delete
EXTRN ??2@YAPAXI@Z:PROC ; operator new
; COMDAT xdata$x
xdata$x SEGMENT
__unwindtable$??0XXX@@QAE@XZ DD 0ffffffffH
DD FLAT:__unwindfunclet$??0XXX@@QAE@XZ$0
__ehfuncinfo$??0XXX@@QAE@XZ DD 019930522H
DD 01H
DD FLAT:__unwindtable$??0XXX@@QAE@XZ
DD 2 DUP(00H)
DD 2 DUP(00H)
DD 00H
DD 01H
; Function compile flags: /Odtp /RTCsu /ZI
xdata$x ENDS
; COMDAT ??0XXX@@QAE@XZ
_TEXT SEGMENT
tv73 = -244 ; size = 4
$T3852 = -236 ; size = 4
$T3853 = -224 ; size = 4
_this$ = -20 ; size = 4
__$EHRec$ = -12 ; size = 12
??0XXX@@QAE@XZ PROC ; XXX::XXX, COMDAT
; _this$ = ecx
; 43 : XXX()
push ebp
mov ebp, esp
push -1
push __ehhandler$??0XXX@@QAE@XZ
mov eax, DWORD PTR fs:0
push eax
sub esp, 232 ; 000000e8H
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-244]
mov ecx, 58 ; 0000003aH
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
push eax
lea eax, DWORD PTR __$EHRec$[ebp]
mov DWORD PTR fs:0, eax
mov DWORD PTR _this$[ebp], ecx
; 44 : {
; 45 : p = new X[X_arr_size];
push 80 ; 00000050H
call ??2@YAPAXI@Z ; operator new
add esp, 4
mov DWORD PTR $T3853[ebp], eax
mov DWORD PTR __$EHRec$[ebp+8], 0
cmp DWORD PTR $T3853[ebp], 0
je SHORT $LN3@XXX
push OFFSET ??0X@@QAE@XZ ; X::X
push 10 ; 0000000aH
push 8
mov eax, DWORD PTR $T3853[ebp]
push eax
call ??_H@YGXPAXIHP6EPAX0@Z@Z;数组初始化函数,前面是构造函数指针、数组中元素个数、元素大小、new到的地址这些参数
mov ecx, DWORD PTR $T3853[ebp]
mov DWORD PTR tv73[ebp], ecx
jmp SHORT $LN4@XXX
$LN3@XXX:
mov DWORD PTR tv73[ebp], 0
$LN4@XXX:
mov edx, DWORD PTR tv73[ebp]
mov DWORD PTR $T3852[ebp], edx
mov DWORD PTR __$EHRec$[ebp+8], -1
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR $T3852[ebp]
mov DWORD PTR [eax], ecx
; 46 : }
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR __$EHRec$[ebp]
mov DWORD PTR fs:0, ecx
pop ecx
pop edi
pop esi
pop ebx
add esp, 244 ; 000000f4H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
_TEXT ENDS
; COMDAT text$x
text$x SEGMENT
__unwindfunclet$??0XXX@@QAE@XZ$0:
mov eax, DWORD PTR $T3853[ebp]
push eax
call ??3@YAXPAX@Z ; operator delete
pop ecx
ret 0
__ehhandler$??0XXX@@QAE@XZ:
mov edx, DWORD PTR [esp+8]
lea eax, DWORD PTR [edx+12]
mov ecx, DWORD PTR [edx-248]
xor ecx, eax
call @__security_check_cookie@4
mov eax, OFFSET __ehfuncinfo$??0XXX@@QAE@XZ
jmp ___CxxFrameHandler3
text$x ENDS
??0XXX@@QAE@XZ ENDP ; XXX::XXX
; Function compile flags: /Odtp /RTCsu /ZI
; COMDAT ??0X@@QAE@XZ
_TEXT SEGMENT
_this$ = -8 ; size = 4
??0X@@QAE@XZ PROC ; X::X, COMDAT
; _this$ = ecx
; 15 : X()
push ebp
mov ebp, esp
sub esp, 204 ; 000000ccH
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-204]
mov ecx, 51 ; 00000033H
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov DWORD PTR _this$[ebp], ecx
; 16 : {
; 17 : i = rand_test();
call ?rand_test@@YAHXZ ; rand_test
mov ecx, DWORD PTR _this$[ebp]
mov DWORD PTR [ecx], eax
; 18 : j = rand_test();
call ?rand_test@@YAHXZ ; rand_test
mov ecx, DWORD PTR _this$[ebp]
mov DWORD PTR [ecx+4], eax
; 19 : }
mov eax, DWORD PTR _this$[ebp]
pop edi
pop esi
pop ebx
add esp, 204 ; 000000ccH
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
??0X@@QAE@XZ ENDP ; X::X
; Function compile flags: /Odtp /RTCsu /ZI
_TEXT ENDS
; COMDAT ??1XXX@@QAE@XZ
_TEXT SEGMENT
$T3867 = -212 ; size = 4
_this$ = -8 ; size = 4
??1XXX@@QAE@XZ PROC ; XXX::~XXX, COMDAT
; _this$ = ecx
; 48 : {
push ebp
mov ebp, esp
sub esp, 216 ; 000000d8H
push ebx
push esi
push edi
push ecx
lea edi, DWORD PTR [ebp-216]
mov ecx, 54 ; 00000036H
mov eax, -858993460 ; ccccccccH
rep stosd
pop ecx
mov DWORD PTR _this$[ebp], ecx
; 49 : delete []p;
mov eax, DWORD PTR _this$[ebp]
mov ecx, DWORD PTR [eax]
mov DWORD PTR $T3867[ebp], ecx
mov edx, DWORD PTR $T3867[ebp]
push edx
call ??3@YAXPAX@Z ; operator delete
add esp, 4
; 50 : }
pop edi
pop esi
pop ebx
add esp, 216 ; 000000d8H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
??1XXX@@QAE@XZ ENDP ; XXX::~XXX
_TEXT ENDS
END