Debugging ASM with Visual Studio - Register conten

2019-02-15 19:16发布

I have been working on an assembly language project for a class and though I have finally been able to work through all problems in this code ( I believe ), I now can't seem to get the Register contents to display.

Here is my code...

include C:\Irvine\Irvine32.inc

.data
;Variables are listed in following order VAR DATATYPE DIGITS[RADIX] with 
comments showing binary version of listed digits
  left DWORD 321                                        ;101000001b
  right DWORD 4247                                  ;1000010010111b 
  total DWORD ?                                 ;uninitialized
  diff DWORD ?                                  ;uninitialized

;Define a string called message containing HELLO WORLD!
message BYTE '"Hello world!"'

;Calculate length of Array and move to var ArrayLength
  Array WORD 1,2,4,8,16,32,64                           ;Array 
  ArrayLength = ($ - Array) / 2

.code
main PROC

;Move left and right to respective registers
  MOV eax,left
  MOV ebx,right

;Add left var and right var and store in new var called total and move to 
ecx
  MOV total,eax
  ADD total,ebx
  MOV ecx,total

;Subtract left var and right var and store in new var called diff and move 
to edx  
  MOV diff,eax
  SUB diff,ebx
  MOV edx,diff

;Move Array to esi
  MOV esi,ArrayLength

  call  DumpRegs 

  exit
main ENDP
END main

When I debug I get no error messages but the IDE does not display the registers or its contents which I need.

I searched everywhere to try and see what might be the problem and got some answers and was able to find some regarding opening the register window in VS on this website...

https://msdn.microsoft.com/en-us/library/62680774.aspx

But I tried to find this window in my IDE even after enabling address-level debugging but to no avail. I don't know if it is a problem with how I installed or is there no register window in VS2017 ... any help would be very welcome

For the record I am using Visual Studio 2017


I have tried adding a wait after call DumpRegs and even a breakpoint but that simply stalls the run and doesn't display the registers whatsoever..

What it looks like after I add a breakpoint

1条回答
神经病院院长
2楼-- · 2019-02-15 19:54

Thanks to @Jester I was able to see the registers window. (See how to use the registers window in the Visual Studio docs.)

It may be trivial but I will state it nonetheless. In order to see the register window you need to input a breakpoint before the exit of the program or write your program to pause on it's own using the Irvine wait macro, or call ReadChar, or similar.

After it pauses, you can reach the register window by going to debug window and windows sub-window, and voila, you have the register contents visible.

查看更多
登录 后发表回答