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 adb: Program Debugger Deleting Breakpoints You can delete a breakpoint from a program by using the :dl command. The command has the form address :dl where address is the address of the breakpoint you wish to delete. The :dl command is typically used to delete breakpoints you no longer wish to use. The following command deletes the breakpoint set at the start of the function main: main:dl Displaying the C Stack Backtrace You can trace the path of all active functions by using the $c command. The command lists the names of all functions that have been called and have not yet returned control, as well as the address from which each function was called and the arguments passed to it. For example, the command $c displays a backtrace of the C language functions called. By default, the $c command displays all calls. If you wish to display just a few, you must supply a count of the number of calls you wish to see. For example, the command ,25$c displays up to 25 calls in the current call path. Note that function calls and argu ments are put on the stack after the function has been called. If you put breakpoints at the entry point to a function, the function will not appear in the list generated by the $c command. You can remedy this problem by placing breakpoints a few instructions into the function. 6-17

adb: Program Debugger XENIX Programming Displaying CPU Registers You can display the contents of all CPU registers by using the $r command. The command displays the name and contents of each register in the CPU as well as the current value of the program counter and the instruction at the current address. The display has the form ax OxO fl OxO bx OxO ip OxO ex OxO cs OxO dx OxO ds OxO di OxO ss OxO si OxO es OxO sp OxO sp OxO 0:0: ad db al, bl The value of each register is given in the current default format. Displaying External Variables You can display the values of all external variables in the program by using the $e command. External variables are the variables in your program that have global scope or have been defined outside of any function. This may include variables defined in library routines used by your program. The $e command is useful whenever you need a list of the names for all available variables or to quickly summarize their values. The command displays one name on each line with the variable's value (if any) on the same line. The display has the form fac: 0. errno: 0. - end: 0. - sobuf: 0. - obuf: 0. - lastbu: 0406. - sibuf: 0. - stkmax: 0. lscadr: 02. iob: 01664. - edata: 0. An Example: Tracing Multiple Functions The following example illustrates how to execute a program under adb control. In particular, it shows how to set breakpoints, start the program, and examine registers and memory. The program to be examined has the following source statements. 6-18

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

Deleting Breakpoints<br />

You can delete a breakpoint from a program by using the :dl command. The command<br />

has the form<br />

address :dl<br />

where address is the address of the breakpoint you wish to delete.<br />

The :dl command is typically used to delete breakpoints you no longer wish to use. The<br />

following command deletes the breakpoint set at the start of the function main:<br />

main:dl<br />

Displaying the C Stack Backtrace<br />

You can trace the path of all active functions by using the $c command. The command<br />

lists the names of all functions that have been called and have not yet returned control,<br />

as well as the address from which each function was called and the arguments passed to<br />

it.<br />

For example, the command<br />

$c<br />

displays a backtrace of the C language functions called.<br />

By default, the $c command displays all calls. If you wish to display just a few, you<br />

must supply a count of the number of calls you wish to see. For example, the command<br />

,25$c<br />

displays up to 25 calls in the current call path.<br />

Note that function calls and argu ments are put on the stack after the function has been<br />

called. If you put breakpoints at the entry point to a function, the function will not<br />

appear in the list generated by the $c command. You can remedy this problem by<br />

placing breakpoints a few instructions into the function.<br />

6-17

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

Saved successfully!

Ooh no, something went wrong!