Search code examples
visual-studio-2010x86masm

View contents of array in Visual Studio (assembly language)


In Visual Studio, is it possible to view the contents of an array when debugging assembly language code? I already know how to add the array num to the "Watch" window, but I'm still trying to figure out how to watch the contents of the array. It's possible to add a sword array to a the "Watch" window in Visual Studio, but is it possible to view the contents of an array while stepping through the program?

.686p
.model flat,stdcall
.stack 2048
.data
num   sword  1000,-1000,2000,-2000 ;I want to keep track of each value in this array while debugging.
;Is it possible to display the contents of all indices of num while debugging?

ExitProcess proto, exitcode:dword
.code

start:![Lots of ?'s are showing up here instead of the actual value of the array][1]

mov ax, num;
mov ax, [num+1];

invoke  ExitProcess, 0
end start

enter image description here


Solution

  • You can display the memory occupied by your array.

    • go to the "memory1" tab next to "auto", "locals", etc
    • type in the symbol name you want to inspect, or select the variable name in the source and drag it to the Address field of the memory window. That is the way I use to do while debugging C code, as I first test it with assembly it appears that I needed to type it "in the C style", that is enter &num to display the address of the num symbol.
    • you can customize the word size to display (from 1 to 8 bytes per word) by right-clicking on the window, and you can choose the number of displayed columns in the toolbar options of the window