Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc

09.06.2013 Views

XENIX Programming int fcnt,gcnt,hcnt; h(x,y) { } g(p,q) { } f(a,b) { } int hi; register int hr; hi = X+ 1; hr = x-y + 1; hcnt + + ; hj : f(hr,hi); int gi; register int gr; gi = q-p; gr = q-p + 1; gent + + ; gj : h(gr,gi); int fi; register int fr; fi = a+ 2*b; fr = a+ b; fcnt + + ; fj : g(fr,fi); main() { f( 1, 1); } adb: Program Debugger The program is compiled and stored in the file named sample. To start the session, type adb sample This starts adb and opens the corresponding program file. There is no core image file. The first step is to set breakpoints at the beginning of each function. You can do this with the :br command. For example, to set a breakpoint at the start of the function f, type f:br 6-19

adb: Program Debugger XENIX Programming You can use similar commands for the g and h functions. Once you have created the breakpoints, you can display their locations by typing $b This command lists the address, optional count, and optional command associated with each breakpoint. In this case, the command displays breakpoints count bkpt command 1 f g - h The next step is to display the first five instructions in the f function. Type f,S?ia This command displays five instructions, each preceded by its symbolic address. The instructions in 8086/286 mnemonics are f: push bp - f + 1.: mov bp,sp - f+3.: push di - f +4.: push si - f + 5.: call chkstk - f+B.: You can display five instructions in g without their addresses by typing g,S?i In this case, the display is - g: push bp mov bp,sp push di push si call chkstk To start program execution, type : r adb displays the message sample: running and begins to execute. As soon as adb encounters the first breakpoint (at the beginning of function f), it stops execution and displays the message 6-20 breakpoint f: push bp

adb: Program Debugger <strong>XENIX</strong> Programming<br />

You can use similar commands for the g and h functions. Once you have created the<br />

breakpoints, you can display their locations by typing<br />

$b<br />

This command lists the address, optional count, and optional command associated with<br />

each breakpoint. In this case, the command displays<br />

breakpoints<br />

count bkpt command<br />

1 f<br />

g<br />

- h<br />

The next step is to display the first five instructions in the f function. Type<br />

f,S?ia<br />

This command displays five instructions, each preceded by its symbolic address. The<br />

instructions in 80<strong>86</strong>/<strong>2<strong>86</strong></strong> mnemonics are<br />

f: push bp<br />

-<br />

f + 1.: mov bp,sp<br />

- f+3.: push di<br />

- f +4.: push si<br />

- f + 5.: call chkstk<br />

-<br />

f+B.:<br />

You can display five instructions in g without their addresses by typing<br />

g,S?i<br />

In this case, the display is<br />

-<br />

g: push bp<br />

mov bp,sp<br />

push di<br />

push si<br />

call chkstk<br />

To start program execution, type<br />

: r<br />

adb displays the message<br />

sample: running<br />

and begins to execute. As soon as adb encounters the first breakpoint (at the beginning<br />

of function f), it stops execution and displays the message<br />

6-20<br />

breakpoint f: push bp

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!