What does Opt.out mean?

Looking at the call stack, I just noticed this:

enter image description here

Pay attention to Opt.out at the top.

Just curious what does Opt.out mean?

Here is the snippet I'm stepping over:

 function BinaryEquals(Left, Right: pointer; Size: integer): boolean; .... {$IFDEF CPUX64} asm .... sub r8,4 @loop1: inc R8 
+6
source share
1 answer

I'm not sure what mnemonics mean, but what the call stack tells you is that it cannot reliably communicate the meaning of the arguments.

Consider this program:

 procedure Foo(Bar: Pointer); asm xor eax,eax end; begin Foo(nil); end. 

Step in Foo . When you do this, the call stack looks like this: 32 bits:

  Project1.Foo (nil)
 Project1.Project1
 : 76f5337a kernel32.BaseThreadInitThunk + 0x12
 : 775b92e2 ntdll.RtlInitializeExceptionChain + 0x63
 : 775b92b5 ntdll.RtlInitializeExceptionChain + 0x36

and this is in 64 bit:

  Project1.Foo (nil)
 Project1.Project1
 : 00000000772959CD;  C: \ Windows \ system32 \ kernel32.dll
 : 00000000773CB981;  ntdll.dll

Then follow the first line of Foo . Now the call stack looks like this: 32 bits:

  Project1.Foo (???)
 Project1.Project1
 : 76f5337a kernel32.BaseThreadInitThunk + 0x12
 : 775b92e2 ntdll.RtlInitializeExceptionChain + 0x63
 : 775b92b5 ntdll.RtlInitializeExceptionChain + 0x36

and this is in 64 bit:

  Project1.Foo (Opt.out)
 Project1.Project1
 : 00000000772959CD;  C: \ Windows \ system32 \ kernel32.dll
 : 00000000773CB981;  ntdll.dll

What the debugger tells you is that the arguments arrived in registers. It does not control what you do with registers when the body of the asm function is executed. And so he refuses to try to communicate the meaning of the arguments.

If you go to the 32-bit compiler and change the calling convention so that the arguments fall on the stack, not the registers, the behavior is different. In this case, the debugger confidently reports the values โ€‹โ€‹of the arguments, because it considers that you are not going to destroy the stack.

In 32-bit, which becomes clear when using ??? . Quite why the text Opt.out used in 64 bits, I do not know, but the meaning of this is clear.

+7
source

Source: https://habr.com/ru/post/989669/


All Articles