Swat Introduction: 3 Address Expressions

Up: GEOS SDK TechDocs | Up | Prev: 2 Notation | Next: 4 On-line Help

Address expressions are used as arguments to any Swat command that accesses memory. For example, the pobject command takes an address expression as an argument and prints out information about the object at that address. An address expression can be a symbol name, which is just the name of a pointer, or a symbol path . A symbol path has the following structure, where scope is the name of a patient, module, function, structure type, union type, enumerated type, or assembly record type:

(<scope>::)+<symbol>

Some of the more common symbol path formats are:

<module>::<symbol>
<patient>::<symbol>
<patient>::<module>::<symbol>
<structure name>::<field name>

The symbol path is used when there is more than one symbol of a given name or if a symbol of a different application is needed. A symbol can be represented in a variety of ways: the name of an object, a field of a structure, a register/number combination, a number from the address history, an element of an array, nested Tcl commands, or a Tcl variable. Array indexing is used as follows:

<addr> [<n>]

which will return the zero-based element n from the given addr , even if addr is not an array.

Another important way of representing the symbol is as a segment:offset pair. In this, the segment is a constant, a register, a module, or a handle ID given as ^h<id> where id is a constant or register.

There are several operators which are used to make memory examination and manipulation easier in Swat. These operators are shown below (in order of highest precedence to lowest):

Much of the time the type of data stored at the address given by the address expression is implicit in the expression. Sometimes in ambiguous situations (using code as data), however, the type of data must be explicitly stated in the address expression. This is done by indicating the type of the data followed by a space and then a normal address expression. For example, in the expression

dword ds:14h

the data at ds:14h will be treated as a double word.


Up: GEOS SDK TechDocs | Up | Prev: 2 Notation | Next: 4 On-line Help