| |||
| Home > Working with Macros > Predefined macros | |||
RealView Debugger recognizes several predefined macros containing commonly used functions. Predefined macros can be used in expressions on the command line and can be called from macros that you create yourself.
Table 10.1 contains a summary of the predefined macros.
Table 10.1. Predefined macros
| Macro name | Description | Syntax | Notes |
|---|---|---|---|
| byte | Returns a byte value from the specified address. | unsigned char byte( | - |
| call | Performs a target function call. Use this to make an application function call from the debugger. | call( | - |
| command | Enables you to construct a command in a string. | command( | Takes only a single argument. |
| dword | Returns a long value from the specified address. | unsigned long dword( | - |
| error | Processes error message returned from macro. | int error( |
The type is one of: 1=note popup 2=warning popup 3=error popup -3=fatal error popup. |
| fgetc | Returns a byte from file or window. These must be previously opened using FOPEN, VOPEN, or the predefined macro fopen. | int fgetc( | - |
| fopen | Opens a file for reading, writing, or both. | int fopen(char * | - |
| fread | Reads a file into a buffer. | unsigned long fread(void * | Acts on a window in addition to a file. |
| fwrite | Writes a buffer to a file. | unsigned long fwrite(void * | Acts on a window in addition to a file. |
| getsym | Takes an address and returns a local string. | char *getsym( | Example: add char x[20] strcpy(x,getsym(@pc)) pr x “Start” The PC is at the label “ |
| isalive | Verifies that a symbol is currently active. | int isalive( | This returns: 0=not available 1=available 2=up the stack -1=does not exist. |
| memchr | Searches for a character in memory. | char *memchr( | - |
| memclr | Clears memory values. | char *memclr( | - |
| memcpy | Copies characters from memory. | char *memcpy( | - |
| memset | Sets the value of characters in memory. | char *memset( | - |
| prompt_file | Displays a file containing message text. The user choice is entered into the buffer (local or target). | int prompt_file(
char *
char * | - |
| prompt_list | Displays a dialog box containing message text and a choice list. This returns: 0=Cancel 1=first list index 2=second list index | int prompt_text(
char *
char * | Initially, the buffer consists of lines to show in the list (separated by \n). Example:
|
| prompt_text | Displays a dialog box containing message text. The user choice is entered into the buffer (local or target). | int prompt_text(
char *
char * | Example:
|
| prompt_yesno() | Displays a dialog box containing question text and buttons (Yes and No). This returns: 0=Yes 2=No. |
int prompt_yesno(
char * | Example:
|
| prompt_yesno_cancel() | Displays a dialog box containing question text and buttons (Yes, No and Cancel). This returns: 0=Yes 1=Cancel 2=No. |
int prompt_yesno_cancel(
char * | Example:
|
| reg_str | Takes a register name from a string and returns the value. |
unsigned long reg_str(char * | - |
| strcat | Concatenates two strings. | char *strcat( | - |
| strchr | Locates the first occurrence of a character in a string. | char *strchr( | - |
| strcmp | Compares two strings. | unsigned long strcmp( | - |
| strcpy | Copies a string. | char *strcpy( | - |
| stricmp | Performs string comparison without case distinction. | char *stricmp( | - |
| strlen | Returns string length. | unsigned long strlen( | - |
| strncmp | Performs limited comparison of two strings. | char *strncmp( | - |
| until | Breaks when an expression evaluates to True. | char until( | - |
| when | Breaks when an expression evaluates to True. | char when( | - |
| word | Returns a word value at the specified address. | unsigned short int word( | - |