没有异常处理产生的代码-1

,跟踪下的代码

  1. #include <iostream>
  2. using namespace std;
  3. class C
  4. {
  5. public:
  6.     C()
  7.     {
  8.     }
  9.     ~C()
  10. {
  11.     }
  12. };
  13. void f1()
  14. {
  15.    C x1;
  16. }
  17. int main()
  18. {//此处设断点
  19.    f1();
  20.    return 0;
  21. }//此处设断点

 

 

  1. --- F:/1/名次.cpp  -------------------------------------------------------------------------------------------------------
  2. 18:
  3. 19:   int main()
  4. 20:   {
  5. 00401320   push        ebp
  6. 00401321   mov         ebp,esp
  7. 00401323   sub         esp,40h
  8. 00401326   push        ebx
  9. 00401327   push        esi
  10. 00401328   push        edi
  11. 00401329   lea         edi,[ebp-40h]
  12. 0040132C   mov         ecx,10h
  13. 00401331   mov         eax,0CCCCCCCCh
  14. 00401336   rep stos    dword ptr [edi]
  15. 21:      f1();
  16. 00401338   call        @ILT+0(f1) (00401005)//跟进去
  17. /*
  18. 22:      return 0;
  19. 0040133D   xor         eax,eax
  20. 23:   }
  21. 0040133F   pop         edi
  22. 00401340   pop         esi
  23. 00401341   pop         ebx
  24. 00401342   add         esp,40h
  25. 00401345   cmp         ebp,esp
  26. 00401347   call        __chkesp (00408210)
  27. 0040134C   mov         esp,ebp
  28. 0040134E   pop         ebp
  29. 0040134F   ret
  30. */
  31. 00401005   jmp         f1 (00401270)//跳转语句
  32. 14:   void f1()
  33. 15:   {
  34. 00401270   push        ebp
  35. 00401271   mov         ebp,esp
  36. 00401273   sub         esp,44h
  37. 00401276   push        ebx
  38. 00401277   push        esi
  39. 00401278   push        edi
  40. 00401279   lea         edi,[ebp-44h]
  41. 0040127C   mov         ecx,11h
  42. 00401281   mov         eax,0CCCCCCCCh
  43. 00401286   rep stos    dword ptr [edi]
  44. 16:      C x1;
  45. 00401288   lea         ecx,[ebp-4]//注意ecx存的是地址
  46. 0040128B   call        @ILT+5(C::C) (0040100a)//跟进去
  47. 17:   }
  48. 00401290   lea         ecx,[ebp-4]
  49. 00401293   call        @ILT+20(C::~C) (00401019)
  50. 00401298   pop         edi
  51. 00401299   pop         esi
  52. 0040129A   pop         ebx
  53. 0040129B   add         esp,44h
  54. 0040129E   cmp         ebp,esp
  55. 004012A0   call        __chkesp (00408210)
  56. 004012A5   mov         esp,ebp
  57. 004012A7   pop         ebp
  58. 004012A8   ret
  59. --- No source file  --------
  60. @ILT+5(??0C@@QAE@XZ):
  61. 0040100A   jmp         C::C (004012c0)//跳转
  62. 6:        C()
  63. 004012C0   push        ebp
  64. 004012C1   mov         ebp,esp
  65. 004012C3   sub         esp,44h
  66. 004012C6   push        ebx
  67. 004012C7   push        esi
  68. 004012C8   push        edi
  69. 004012C9   push        ecx
  70. 004012CA   lea         edi,[ebp-44h]
  71. 004012CD   mov         ecx,11h
  72. 004012D2   mov         eax,0CCCCCCCCh
  73. 004012D7   rep stos    dword ptr [edi]
  74. 004012D9   pop         ecx
  75. 004012DA   mov         dword ptr [ebp-4],ecx//注意是地址给它
  76. 7:        {
  77. 8:        }
  78. 004012DD   mov         eax,dword ptr [ebp-4]//
  79. 004012E0   pop         edi
  80. 004012E1   pop         esi
  81. 004012E2   pop         ebx
  82. 004012E3   mov         esp,ebp
  83. 004012E5   pop         ebp
  84. 004012E6   ret
  85. --- No source file  
  86. 17:   }
  87. 00401290   lea         ecx,[ebp-4]
  88. 00401293   call        @ILT+20(C::~C) (00401019) 跟进去
  89. /*
  90. 00401298   pop         edi
  91. 00401299   pop         esi
  92. 0040129A   pop         ebx
  93. 0040129B   add         esp,44h
  94. 0040129E   cmp         ebp,esp
  95. 004012A0   call        __chkesp (00408210)
  96. 004012A5   mov         esp,ebp
  97. 004012A7   pop         ebp
  98. 004012A8   ret
  99. */
  100. @ILT+20(??1C@@QAE@XZ):
  101. 00401019   jmp         C::~C (004012f0)
  102. 9:        ~C()
  103. 10:   {
  104. 004012F0   push        ebp
  105. 004012F1   mov         ebp,esp
  106. 004012F3   sub         esp,44h
  107. 004012F6   push        ebx
  108. 004012F7   push        esi
  109. 004012F8   push        edi
  110. 004012F9   push        ecx
  111. 004012FA   lea         edi,[ebp-44h]
  112. 004012FD   mov         ecx,11h
  113. 00401302   mov         eax,0CCCCCCCCh
  114. 00401307   rep stos    dword ptr [edi]
  115. 00401309   pop         ecx
  116. 0040130A   mov         dword ptr [ebp-4],ecx
  117. 11:       }
  118. 0040130D   pop         edi
  119. 0040130E   pop         esi
  120. 0040130F   pop         ebx
  121. 00401310   mov         esp,ebp
  122. 00401312   pop         ebp
  123. 00401313   ret
  124. //返回到f1()结尾处
  125. 00401298   pop         edi
  126. 00401299   pop         esi
  127. 0040129A   pop         ebx
  128. 0040129B   add         esp,44h
  129. 0040129E   cmp         ebp,esp
  130. 004012A0   call        __chkesp (00408210)
  131. 004012A5   mov         esp,ebp
  132. 004012A7   pop         ebp
  133. 004012A8   ret
  134. --- No source file  -------------
  135. //返回到mian函数
  136. 22:      return 0;
  137. 0040133D   xor         eax,eax
  138. 23:   }
  139. 0040133F   pop         edi
  140. 00401340   pop         esi
  141. 00401341   pop         ebx
  142. 00401342   add         esp,40h
  143. 00401345   cmp         ebp,esp
  144. 00401347   call        __chkesp (00408210)
  145. 0040134C   mov         esp,ebp
  146. 0040134E   pop         ebp
  147. 0040134F   ret

你将发现f1()函数非常接近预料:设置栈框架,调用xl的构造和析构函数,然后重设栈框架。特别地,你将注意到没有任何EH产物或记录――并不奇怪,因为程序没有抛出或捕获任何异常。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值