Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I display the value of the register EAX as an object in the debugger?

I would like to inspect a method's return value without having to re-execute the method itself. I believe my only option is to use the disassembler. I came to this conclusion after reading the responses to Stackflow question Getting a Method's Return Value in the VS Debugger.

I think the value in register EAX is my return value. How do I inspect the object pointed to by EAX in the debugger? Here is my disassembled return statement.

   30:             return SomeString();
000001bb  mov         ecx,dword ptr [ebp-3Ch] 
000001be  call        FFF7A320 
000001c3  mov         dword ptr [ebp-78h],eax 
000001c6  mov         eax,dword ptr [ebp-78h] 
000001c9  mov         dword ptr [ebp-4Ch],eax 
000001cc  nop 
000001cd  jmp         000001D8 
000001cf  mov         dword ptr [ebp-1Ch],0 
000001d6  jmp         000001BA 
    31:         }
000001d8  mov         eax,dword ptr [ebp-4Ch] 
000001db  lea         esp,[ebp-0Ch] 
000001de  pop         ebx 
000001df  pop         esi 
000001e0  pop         edi 
000001e1  pop         ebp 
000001e2  ret 
like image 591
Don Avatar asked Oct 18 '25 18:10

Don


2 Answers

ISTR [EAX] in the variable watch window displays the EAX register.

like image 129
sbi Avatar answered Oct 20 '25 09:10

sbi


From the Registers window, select the EAX register value and hit Ctrl+C. Debug + Windows + Memory + Memory 1. In the Address text box, type 0x, Ctrl+V, type +12. The +12 skips the System.Object header. You should have little trouble reading it on the right if it contains ASCII characters, ignore the nulls.

like image 41
Hans Passant Avatar answered Oct 20 '25 09:10

Hans Passant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!