Download presentation
Presentation is loading. Please wait.
1
CSC235 - Visual Studio Tutorial
Running and Debugging MASM Assembly Language Programs
2
First Example Copy the AddVariables folder from the shared drive to your computer S:\ComputerScience\Carelli\CSC235\Examples\VisualStudio\AddVariables Navigate into your new ‘AddVariables’ directory and double click on the file Project235.sln This will open the project in Visual Studio
3
Note: if you don’t see code as shown in this window, double-click on the .asm file here
4
Running AddVariables To run the program, click on “Local Windows Debugger” (circled on the previous slide) This will produce an output window as below: Registers are output from the Irvine routine DumpRegs WaitMsg causes the program to pause as shown Note the value stored in EAX
5
Setting Breakpoints A program can be halted at any point in its execution, allowing a user to view register and memory values This is done by setting a breakpoint Simply click in the margin next to a command you want to halt on Once a breakpoint is set, begin execution as before The program will pause when it reaches that point see the next slide…
6
2 1: set the breakpoint 1 3 2: start the run (Local Windows Debugger)
3: execution pauses at the selected command Note: changes to Continue 1 2 3
7
Debug Mode You are now in Debug Mode You have some choices: you can
add another breakpoint … then, click on continue (see last slide) program proceeds to next break point Or.. single step though the code progress one command at a time (next slide)
8
1: click here to single-step
2: program executes one instruction and advances to the next 1 2
9
Monitoring Registers While in Debug Mode, you can view changes to Registers Debug->Windows->Registers This will open a window for viewing the registers (next slide) NOTE: you MUST do this while you are in Debugging mode!!!!
10
1: Registers Window 2: Changes to Register values appear in red after every instruction Note: right click in the Registers Window and check Flags to view flag settings
11
Monitoring Memory While in Debug Mode, you can view changes to Memory values Debug->Windows->Memory This will open a new tab for viewing memory locations (next slide) You can open up to 4 tabs NOTE: you MUST do this while you are in Debugging mode!!!!
12
New tab for viewing memory locations
Click on it to get to memory view (next slide)
13
To view a memory location
Type in & and the label for the memory location (&finalVal) Memory address of that location is displayed The contents of that location will be displayed as bytes value of finalVal is h Note how it takes up 4 bytes and is in Little Endian order!
14
Do it yourself Try setting a breakpoint as shown, then step through the program Watch the registers get updated in the Registers Window as each command executes Set up and go to the Memory tab and see the value of finalVal get updated note the Little Endian storage!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.