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 Validating Addresses Whenever you use an address in a command, adb checks the address to make sure it is valid. adb uses the segment number, file position, and size values in each map entry to validate the addresses. If an address is correct, adb carries out the command; otherwise, it displays an error message. The first step adb takes when validating an address is to check the segment value to make sure it belongs to the appropriate map. Segments used with the ? command must appear in the text segments map; segments used with the I command must appear in the data segments map. If the value does not belong to the map, adb displays a bad segment error. The next step is to check the offset to see if it is in range. The offset must be within the range 0 < = offset < = segment-size If it is not in this range, adb displays a bad address error. If adb is currently accessing memory, the validating segment and offset are used to access a memory location and no other processing takes place. If adb is accessing files, it computes an effective file address as follows: effective-fi le-address = offset + fi le-position then uses this effective address to read from the corresponding file. Miscellaneous Features The following sections explain how to use a number of useful miscellaneous commands and features of adb. Combining Comma nds on a Single Line You can give more than one command on a line by separating the commands with a semicolon (;). The com mands are performed one at a time, starting at the left. Changes to the current address and format are carried to the next command. If an error occurs, the remaining commands are ignored. One typical combination is to place a ? command after an 1 command. For example, the commands ?I 'Th'; ?s search for and display a string that begins with the characters "Th". 6-25

adb: Program Debugger XENIX Programming Creati ng adb Scripts You can direct adb to read commands from a text file instead of the keyboard by redirecting adb's standard input file at invocation. To redirect the standard input, use the standard redirection symbol < and supply a file name. For example, to read commands from the file script, type adb sample

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

Validating Addresses<br />

Whenever you use an address in a command, adb checks the address to make sure it is<br />

valid. adb uses the segment number, file position, and size values in each map entry to<br />

validate the addresses. If an address is correct, adb carries out the command;<br />

otherwise, it displays an error message.<br />

The first step adb takes when validating an address is to check the segment value to<br />

make sure it belongs to the appropriate map. Segments used with the ? command must<br />

appear in the text segments map; segments used with the I command must appear in the<br />

data segments map. If the value does not belong to the map, adb displays a bad segment<br />

error.<br />

The next step is to check the offset to see if it is in range. The offset must be within<br />

the range<br />

0 < = offset < = segment-size<br />

If it is not in this range, adb displays a bad address error.<br />

If adb is currently accessing memory, the validating segment and offset are used to<br />

access a memory location and no other processing takes place. If adb is accessing files,<br />

it computes an effective file address as follows:<br />

effective-fi le-address = offset + fi le-position<br />

then uses this effective address to read from the corresponding file.<br />

Miscellaneous Features<br />

The following sections explain how to use a number of useful miscellaneous commands<br />

and features of adb.<br />

Combining Comma nds on a Single Line<br />

You can give more than one command on a line by separating the commands with a<br />

semicolon (;). The com mands are performed one at a time, starting at the left. Changes<br />

to the current address and format are carried to the next command. If an error occurs,<br />

the remaining commands are ignored.<br />

One typical combination is to place a ? command after an 1 command. For example,<br />

the commands<br />

?I 'Th'; ?s<br />

search for and display a string that begins with the characters "Th".<br />

6-25

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

Saved successfully!

Ooh no, something went wrong!