mahmood
mahmood

Reputation: 24665

Disassembly code from visual studio

Using WinDBG for debugging the assembly code of an executable, it seems that compiler inserts some other codes between two sequential statements. The statements are pretty simple, e.g. they don't work with complex objects for function calls;

int a, b;
char c;
long l;
a = 0;          // @@
b = a + 1;      // %%
c = 1;          // ##
l = 1000000;
l = l + 1;

And the disassembly is

@@    008a1725 c745f800000000  mov     dword ptr [ebp-8],0
008a172c 80bd0bffffff00  cmp     byte ptr [ebp-0F5h],0      ss:002b:0135f71f=00
008a1733 750d            jne     test!main+0x42 (008a1742)
008a1735 687c178a00      push    offset test!main+0x7c (008a177c)
008a173a e893f9ffff      call    test!ILT+205(__RTC_UninitUse) (008a10d2)
008a173f 83c404          add     esp,4
008a1742 8b45ec          mov     eax,dword ptr [ebp-14h]
%% 008a1745 83c001          add     eax,1
008a1748 c6850bffffff01  mov     byte ptr [ebp-0F5h],1
008a174f 8945ec          mov     dword ptr [ebp-14h],eax
## 008a1752 c645e301        mov     byte ptr [ebp-1Dh],1

Please note that @@, %% and ## in the disassembly list show the corresponding C++ lines.

So what are that call, cmp, jne and push?

enter image description here

Upvotes: 0

Views: 976

Answers (1)

invictus1306
invictus1306

Reputation: 587

It is the compiler run-time error checking (RTC), the RTC switch check for uninitialized variables, I think that you can manage it from Visual Studio (compiler options).

For more information, take a look to this. Section /RTCu switch

Upvotes: 1

Related Questions