debuggers a program needed when writing any type of code displays the contents of memory lets you...
TRANSCRIPT
![Page 1: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/1.jpg)
Debuggers
• A program needed when writing any type of code
• Displays the contents of memory
• Lets you view registers and variables and see how they change
• Allows tracing (stepping through a program one line at a time)
![Page 2: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/2.jpg)
Debug
• A debugger supplied with both DOS and Windows
• Debug.exe• Found in \Windows\command• Command line driven• A precursor of Microsoft Codeview,
Borland Turbo Debugger, Visual Studio Debuggers, Periscope, Atron, SYMDEB, Codesmith-86, Advanced-Trace-86
![Page 3: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/3.jpg)
Assembly Level Debugger
• Debug is an assembly level debugger– Displays only assembly mnemonics and
machine instructions.
C> debug sample.exe
Debug.exe
Sample.exe
DOS0000
![Page 4: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/4.jpg)
Debugging Functions
• Assemble short programs• View a program’s source code along with its machine
language• View the CPU registers and flags• Trace or execute a program, watching variables for
changes• Enter new values into memory• Search for binary or ASCII values in memory• Move a block of memory from one location to another• Fill a block of memory• Load and write disk files and sectors
![Page 5: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/5.jpg)
Debug Commands
• Can be divided into four categories– Program creation/debugging– Memory manipulation– Miscellaneous– Input-output
![Page 6: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/6.jpg)
Command Parameters
• Addresses– can be given as either a complete segment-
offset or just an offset– Segment portion may be a hex number or a
register name• F000:100 segment, offset• DS:200 segment register, offset• 0AF5 offset
![Page 7: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/7.jpg)
Command Parameters
• Address Ranges– Format 1: address [.address]
• 100, 500• CS:200, 300• 200
– Format 2: address L [value]• 100 L 20 (20h bytes starting at location 100h)
![Page 8: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/8.jpg)
Command Parameters
• Strings – a sequence of characters enclosed in single or double quotes.
• ‘command’• “File can not be opened.”
• Filespec – • B:prog1.com• C:\asm\progs\test.com• File1
• Values – consists of 1- to 4-character hex number.
![Page 9: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/9.jpg)
Example commands
• -D (Dump)– Displays memory on the screen as single
bytes in both hex and ASCIINo range given => dumps 128 bytes from last
referenced location-d 0-200 => dumps offsets 0-200 from DS-d SS:0 5 => dumps the bytes at offsets 0-5
from SS.-d 915:0 => dumps 128 bytes from segment
0915h
![Page 10: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/10.jpg)
Example Commands
• -R (Registers)-r =>display the contents of all registers
-r IP => display the contents of IP and prompt for a new value
-r CX => display the contents of CX and prompt for a new value
-r F => display all flags and prompt for a new flag value.
![Page 11: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/11.jpg)
Flags
Set• OV = Overflow• DN = Direction Down• EI = Interrupts enabled• NG = Sign Flag negative• ZR = Zero• AC = Auxiliary Carry• PO = Odd Parity• CY= Carry
Clear• NV = No Overflow• UP = Direction Up• DI = Interrupts Disabled• PL = Sign Flag Positive• NZ = Not Zero• NA = No Auxiliary Carry• PE = Even Parity• NC = No Carry
![Page 12: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/12.jpg)
Example Commands
• A (Assemble)– Assemble a program into machine language
• A 100 => assemble at CS:100• A => assemble from the current location• A DS:2000 => Assemble at DS:2000h
– Pressing enter at the end of a line, returns a prompt for the next line of input. To terminate input, press the Enter key on a blank line.
-a 1005514:0100 mov ah, 25514:0102 mov dl, 415514:0104 int 215514:0106
![Page 13: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/13.jpg)
Example Commands
• -T (Trace) executes one or more instructions starting at either the current CS:IP location or at an optional address.-t => trace the next instruction
-t 5 => trace the next five instructions
-t =105 10 => trace 16 instructions starting at CS:105
![Page 14: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/14.jpg)
Segment Defaults
Command Description Default Segment
A Assemble CS
D Dump DS
E Enter DS
F Fill CS
G Go(execute) CS
L Load DS
M Move DS
P Procedure Trace CS
S Search DS
T Trace CS
U Unassemble CS
W Write CS
![Page 15: Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change](https://reader036.vdocuments.net/reader036/viewer/2022083006/56649f2f5503460f94c4911a/html5/thumbnails/15.jpg)
Lab #1 and Lab #2
• First two labs will allow you to explore using Debug.