SourcePoint AMD Help

Table of Contents

getprogramsymboladdress

Return the address of the symbol referenced by symbol name.

Syntax

[result =] GetProgramSymbolAddress(symbol_name)

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_name

is a constant string, nstring, or debug variable specifying the symbol to look up.

Discussion

The getprogramsymboladdress command searches each program loaded in the current context for the specified symbol. If the symbol is found, its address is returned. ย Otherwise, an error is raised. This function is intended to be used in conjunction with Isprogramsymbol() in macro procedure scenarios where program symbols may not be present when the macro is interpreted.

The following examples demonstrate the getprogramsymboladdress command. Here it is assumed that a program is loaded which contains the data symbol mydata at address C0001000 and a procedure symbol mycode at address C0008000.

Example 1

Command input:

if (IsProgramSymbol("mydata"))
getProgramSymbolAddress("mydata")

Result:

0xC0001000

Example 2

Command input:

define nstring s = "mydata"
getProgramSymbolAddress(s)

Result:

0xC0001000

Example 3

Command input:

getProgramSymbolAddress("mycode")

Result:

0xC0008000

Example 4

Command input:

getProgramSymbolAddress("test")

Result:

Error "test" is not a program symbol

Related Topics: