SourcePoint AMD Help

Table of Contents

last

Return the last address of a symbol.

Syntax

[result =] last(symbol)
[result =] last(:module.procedure)

Where:

result

specifies a pointer variable to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

symbol

is a symbolic reference to a program item (label, variable, array, structure, constant, procedure, module, or program). ย 

module

is a symbolic reference to a module.

procedure

is a symbolic reference to a procedure.

Discussion

The last function returns the last address occupied by a program item. ย This function may be used in SourcePoint wherever an address is used.

There are some caveats to using the last function:

  • The return value of last when the argument is a label is the same address you get when you just type the label.

  • Local variables are stack variables and do not have an address that can be determined beforehand, so the last function does not work unless those variables are in scope.

  • Register variables do not have addresses so the last function will not work with them.

  • The return value of last when the argument is a non-external procedure in a module that has not been analyzed will be the same address that is returned when just then procedure name is typed, which is incorrect. Because the module has not been analyzed, the symbol for the procedure is just a label and does not return an address that is the last address of the procedure (see Bullet 1). To insure that the module is analyzed, use the second syntax shown above.

Example 1

To find the first and last address of the global structure fooStruct (note that an โ€™&โ€™ must be prepended to the symbol fooStruct; otherwise, the command language evaluates fooStruct and return its contents):

Command input:

&fooStruct

Result:

000080C8

Command input:

last(fooStruct)

Result:

000080D3

Example 2

To find the first and last address of the procedure fooFunk:

Command input:

fooFunk

Result:

00000240

Command input:

last(fooFunk)

Result:

00000273

Related Topics

ย 

ย