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 Setting the Maximum Offset adb normally displays memory and file addresses as the sum of a symbol and an offset. This helps associate the instructions and data you are viewing with a given function or variable. When first invoked, adb sets the maximum offset to 255. This means instructions or data no more than 255 bytes from the start of the function or variable are given symbolic addresses. Instructions or data beyond this point are given numeric addresses. In many programs, the size of a function or variable is actually larger than 255 bytes. For this reason adb lets you change the maximum offset to accommodate larger programs. You can change the maximum offset by using the $s command. The command has the form n$s where n is an integer giving the new offset. For example, the command 4095$s increases the maximum possible offset to 4095. All instructions and data no more than 4095 bytes away are given symbolic addresses. Note that you can disable all sy mbolic addressing by setting the maximum offset to zero. All addresses will be given nu meric values instead. Setting Default Input Format You can set the default format for numbers used in commands with the $d (decimal), $o (octal), and $x (hexadecimal) commands. The default format tells adb how to interpret numbers that do not begin with "O" or "Ox" and how to display numbers when no specific format is given. The commands are useful if you wish to work with a combination of decimal, octal, and hexadecimal numbers. For example, if you use $x you may give addresses in hexadecimal without prepending each address with "Ox". Furthermore, adb displays all numbers in hexadecimal except those specifically requested to be in some other format. When you first start adb, the default format is decimal. You may change this at any time and restore it as necessary using the $d command. 6-27

adb: Program Debugger XENIX Programming Using XENIX Commands You can execute XENIX commands without leaving adb by using the adb escape command !. The escape command has the form command where command is the XENIX command you wish to execute. The command must have any required arguments. adb passes this command to the system shell, which executes it. When finished, the shell returns control to adb. For example, to display the date, type ! date The system displays the date at your terminal and returns control to adb. Computing Numbers and Displaying Text You can perform arithmetic calculations while in adb by using the = command. The command directs adb to display the value of an expression in a given format. The command is often used to convert numbers in one base to another, to double-check the arithmetic performed by a program, and to display complex addresses in simpler form. For example, the command Ox2a = d displays the hexadecimal number Ox2a as the decimal nu mber 42, but Ox2a = c displays it as the ASCII character "*"· Expressions in a com mand may have any combination of symbols and operators. For example, the command

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

Setting the Maximum Offset<br />

adb normally displays memory and file addresses as the sum of a symbol and an offset.<br />

This helps associate the instructions and data you are viewing with a given function or<br />

variable. When first invoked, adb sets the maximum offset to 255. This means<br />

instructions or data no more than 255 bytes from the start of the function or variable<br />

are given symbolic addresses. Instructions or data beyond this point are given numeric<br />

addresses.<br />

In many programs, the size of a function or variable is actually larger than 255 bytes.<br />

For this reason adb lets you change the maximum offset to accommodate larger<br />

programs. You can change the maximum offset by using the $s command. The<br />

command has the form<br />

n$s<br />

where n is an integer giving the new offset. For example, the command<br />

4095$s<br />

increases the maximum possible offset to 4095. All instructions and data no more than<br />

4095 bytes away are given symbolic addresses.<br />

Note that you can disable all sy mbolic addressing by setting the maximum offset to<br />

zero. All addresses will be given nu meric values instead.<br />

Setting Default Input Format<br />

You can set the default format for numbers used in commands with the $d (decimal), $o<br />

(octal), and $x (hexadecimal) commands. The default format tells adb how to interpret<br />

numbers that do not begin with "O" or "Ox" and how to display numbers when no specific<br />

format is given.<br />

The commands are useful if you wish to work with a combination of decimal, octal, and<br />

hexadecimal numbers. For example, if you use<br />

$x<br />

you may give addresses in hexadecimal without prepending each address with "Ox".<br />

Furthermore, adb displays all numbers in hexadecimal except those specifically<br />

requested to be in some other format.<br />

When you first start adb, the default format is decimal. You may change this at any<br />

time and restore it as necessary using the $d command.<br />

6-27

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

Saved successfully!

Ooh no, something went wrong!