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 Decimal, Octal, and Hexadecimal Integers Decimal integers must begin with a nonzero decimal digit. Octal numbers must begin with a zero and may have octal digits only. Hexadecimal numbers must begin with the prefix "Ox" and may contain decimal digits and the letters "a" through "f" {in both uppercase and lowercase). The following are valid numbers: Decimal 34 4090 Octal 042 07772 Hexadecimal Ox22 Oxffa Although decimal numbers are displayed with a trailing decimal point (.), you must not use the decimal point when typing the number. Symbols Symbols are the names of global variables and functions defined within the program being debugged and are equal to the address of the given variable or function. Symbols are stored in the program's symbol table and are available if the symbol table has not been stripped from the program file (see strip in Appendix B, "Programming Commands"). In expressions, you may spell the symbol exactly as it is in the source program or as it has been stored in the symbol table. Symbols in the symbol table are no more than eight characters long, and those defined in C programs are given a leading underscore ( -). The following are examples of symbols: main main hex2bin out of Note that if the spelling of any two symbols is the same (except for a leading underscore), adb will ignore one of the symbols and allow references only to the other. For example, if both "main" and "_main" exist in a program, then adb accesses only the first to appear in the source and ignores the other. When you use the ? command, adb uses the symbols found in the symbol table of the program file to create symbolic addresses. Thus, the command sometimes gives a function name when it displays data. This does not happen if the ? command is used for text (instructions) and the I command for data. Local variables cannot be addressed. 6-5

adb: Program Debugger XENIX Programming adb Va riables adb automatically creates a set of its own variables whenever you start the debugger. These variables are set to the addresses and sizes of various parts of the program file as defined below. d size of data e entry address of the program m execution type n number of segments t size of text adb reads the program file to find the values for these variables. If the file does not seem to be a program file, then adb leaves the values undefined. You can use the current value of a variable in an expression by preceding the variable name with a less-than sign ( variable-name where expression is the value to be assigned to the variable, and variable-name must be a single letter. For example, the assignment Ox2000 >b assigns the hexadecimal value "Ox2000" to the variable b. You can display the value of all currently defined adb variables by using the $v command. The command lists the variable names followed by their values in the current format and displays any variable with a value that is not zero. If a variable also has a nonzero segment value, the variable's value is displayed as an address; otherwise it is displayed as a number. 6-6

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

Decimal, Octal, and Hexadecimal Integers<br />

Decimal integers must begin with a nonzero decimal digit. Octal numbers must begin<br />

with a zero and may have octal digits only. Hexadecimal numbers must begin with the<br />

prefix "Ox" and may contain decimal digits and the letters "a" through "f" {in both<br />

uppercase and lowercase). The following are valid numbers:<br />

Decimal<br />

34<br />

4090<br />

Octal<br />

042<br />

07772<br />

Hexadecimal<br />

Ox22<br />

Oxffa<br />

Although decimal numbers are displayed with a trailing decimal point (.), you must not<br />

use the decimal point when typing the number.<br />

Symbols<br />

Symbols are the names of global variables and functions defined within the program<br />

being debugged and are equal to the address of the given variable or function. Symbols<br />

are stored in the program's symbol table and are available if the symbol table has not<br />

been stripped from the program file (see strip in Appendix B, "Programming<br />

Commands").<br />

In expressions, you may spell the symbol exactly as it is in the source program or as it<br />

has been stored in the symbol table. Symbols in the symbol table are no more than eight<br />

characters long, and those defined in C programs are given a leading underscore ( -).<br />

The following are examples of symbols:<br />

main main hex2bin out of<br />

Note that if the spelling of any two symbols is the same (except for a leading<br />

underscore), adb will ignore one of the symbols and allow references only to the other.<br />

For example, if both "main" and "_main" exist in a program, then adb accesses only the<br />

first to appear in the source and ignores the other.<br />

When you use the ? command, adb uses the symbols found in the symbol table of the<br />

program file to create symbolic addresses. Thus, the command sometimes gives a<br />

function name when it displays data. This does not happen if the ? command is used for<br />

text (instructions) and the I command for data. Local variables cannot be addressed.<br />

6-5

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

Saved successfully!

Ooh no, something went wrong!