TotalView User Guide : Part II: Debugging Tools and Tasks : Evaluating Expressions : Using the Evaluate Window : Writing Assembler Code
Writing Assembler Code
On the RS/6000 IBM AIX operating system, TotalView lets you use assembler code in eval points, conditional breakpoints, and in the Tools > Evaluate Dialog Box. However, if you want to use assembler constructs, you must enable compiled expressions. See About Interpreted and Compiled Expressions” for instructions.
To indicate that an expression in the breakpoint or Evaluate Dialog Box is an assembler expression, click the Assembler button in the Action Point > Properties Dialog Box.
Figure 182: Using Assembler Expressions
You write assembler expressions in the target machine’s native assembler language and in a TotalView assembler language. However, the operators available to construct expressions in instruction operands, and the set of available pseudo-operators, are the same on all machines, and are described below.
The TotalView assembler accepts instructions using the same mnemonics recognized by the native assembler, and it recognizes the same names for registers that native assemblers recognize.
Some architectures provide extended mnemonics that do not correspond exactly with machine instructions and which represent important, special cases of instructions, or provide for assembling short, commonly used sequences of instructions. The TotalView assembler recognizes mnemonics if:
*They assemble to exactly one instruction.
*The relationship between the operands of the extended mnemonics and the fields in the assembled instruction code is a simple one-to-one correspondence.
Assembler language labels are indicated as name: and appear at the beginning of a line. You can place a label alone on a line. The symbols you can use include labels defined in the assembler expression and all program symbols.
The TotalView assembler operators are described in the following table:
 
Operators
Description
+
Plus
-
Minus (also unary)
*
Multiplication
#
Remainder
/
Division
&
Bitwise AND
^
Bitwise XOR
!
Bitwise OR NOT (also unary minus, bitwise NOT)
|
Bitwise OR
(expr)
Grouping
<<
Left shift
>>
Right shift
text
Text string, 1-4 characters long, is right-justified in a 32-bit word
hi16 (expr)
Low 16 bits of operand expr
hi32 (expr)
High 32 bits of operand expr
lo16 (expr)
High 16 bits of operand expr
lo32 (expr)
Low 32 bits of operand expr
The TotalView assembler pseudo-operations are as follows:
 
Pseudo Ops
Description
$debug [ 0 | 1 ]
Internal debugging option.
With no operand, toggle debugging;
0 => turn debugging off
1 => turn debugging on
$hold
$holdprocess
Hold the process
$holdstopall
$holdprocessstopall
Hold the process and stop the control group
$holdthread
Hold the thread
$holdthreadstop
$holdthreadstopprocess
Hold the thread and stop the process
$holdthreadstopall
Hold the thread and stop the control group
$long_branch expr
Branch to location expr using a single instruction in an architecture-independent way; using registers is not required
$ptree
Internal debugging option.
Print assembler tree
$stop
$stopprocess
Stop the process
$stopall
Stop the control group
$stopthread
Stop the thread
name=expr
Same as def name,expr
align expr [, expr ]
Align location counter to an operand 1 alignment; use operand 2 (or 0) as the fill value for skipped bytes
ascii string
Same as string
asciz string
Zero-terminated string
bss name,size-expr[,expr]
Define name to represent size-expr bytes of storage in the bss section with alignment optional expr; the default alignment depends on the size:
 
if size-expr >= 8 then 8 else
if size-expr >= 4 then 4 else
if size-expr >= 2 then 2 else 1
byte expr [, expr ] ...
Place expr values into a series of bytes
comm name,expr
Define name to represent expr bytes of storage in the bss section; name is declared global; alignment is as in bss without an alignment argument
data
Assemble code into data section (data)
def name,expr
Define a symbol with expr as its value
double expr [, expr ] ...
Place expr values into a series of doubles
equiv name,name
Make operand 1 an abbreviation for operand 2
fill expr, expr, expr
Fill storage with operand 1 objects of size operand 2, filled with value operand 3
float expr [, expr ] ...
Place expr values into a series of floating point numbers
global name
Declare name as global
half expr [, expr ] ...
Place expr values into a series of 16-bit words
lcomm name,expr[,expr]
Identical to bss
lsym name,expr
Same as def name,expr but allows redefinition of a previously defined name
org expr [, expr ]
Set location counter to operand 1 and set operand 2 (or 0) to fill skipped bytes
quad expr [, expr ] ...
Place expr values into a series of 64-bit words
string string
Place string into storage
text
Assemble code into text section (code)
word expr [, expr ] ...
Place expr values into a series of 32-bit words
zero expr
Fill expr bytes with zeros