[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

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:


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


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.


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


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

Using adb Expressions

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]