[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs

Computing Numbers and Displaying Text

You can perform arithmetic calculations while in the adb debug program by using the equal sign (=) subcommand. This command directs the adb program to display the value of an expression in a specified format. The command converts numbers in one base to another, double-checks the arithmetic performed by a program, and displays complex addresses in simpler form. For example, the following command displays the hexadecimal number 0x2a as the decimal number 42:

0x2a=d
        42

Similarly, the following command displays 0x2a as the ASCII character * (asterisk):

0x2a=c
        *

Expressions in a command can have any combination of symbols and operators. For example, the following command computes a value using the contents of the r0 and r1 registers and the adb variable b.

<r0-12*<r1+<b+5=X
    8fa86f95

You can also compute the value of external symbols to check the hexadecimal value of an external symbol address, by entering:

main+5=X
    2000038d

The equal sign (=) subcommand can also display literal strings. Use this feature in the adb program scripts to display comments about the script as it performs its commands. For example, the following subcommand creates three lines of spaces and then prints the message C Stack Backtrace :

=3n"C Stack Backtrace"

Related Information

adb Debug Program Overview.

Displaying and Manipulating the Source File with the adb Program.

adb Debug Program Expressions

The adb command.


[ Previous | Next | Contents | Glossary | Home | Search ]