Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

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 Allows tracing (stepping through a program one line at a time)

2 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

3 Assembly Level Debugger Debug is an assembly level debugger –Displays only assembly mnemonics and machine instructions. C> debug sample.exe Debug.exe Sample.exe DOS 0000

4 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

5 Debug Commands Can be divided into four categories –Program creation/debugging –Memory manipulation –Miscellaneous –Input-output

6 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:100segment, offset DS:200segment register, offset 0AF5offset

7 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)

8 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.

9 Example commands -D (Dump) –Displays memory on the screen as single bytes in both hex and ASCII No 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

10 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.

11 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

12 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 100 5514:0100 mov ah, 2 5514:0102 mov dl, 41 5514:0104 int 21 5514:0106

13 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

14 Segment Defaults CommandDescriptionDefault Segment AAssembleCS DDumpDS EEnterDS FFillCS GGo(execute)CS LLoadDS MMoveDS PProcedure TraceCS SSearchDS TTraceCS UUnassembleCS WWriteCS

15 Lab #1 and Lab #2 First two labs will allow you to explore using Debug.


Download ppt "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."

Similar presentations


Ads by Google