2.3.1. ADD

Creates a symbol and adds it to the debugger symbol table.


ADD [type] symbol_name [&address] [=value [,value]...]



One of the following data types:


The symbol represents a location holding a four byte signed integer value. This is the default type of symbols.


The symbol represents a location holding a one byte value.


The symbol represents a location holding a two byte signed value.


The symbol represents a location holding a four byte signed value.

long long

The symbol represents a location holding an 8-byte signed value.

You can also:

  • Prefix the data type with unsigned.

  • Use the data types together with * and [] to indicate pointer and array variables, using the C language syntax.

    If the symbol is an array, then you must specify the array size after the symbol name within the square brackets. You can define multidimensional arrays by appending several bracketed array dimensions.

  • Create symbols with type float or double, but you cannot initialize them with a value in the ADD statement.

  • Create references to existing instances of the following types:


    The symbol is an instance of, or a pointer to, a C structure.


    The symbol is an instance of, or a pointer to, a C enumeration.


    The symbol is an instance of, or a pointer to, a C union.

    You cannot create new enumerations, structures, or unions. You cannot initialize complete structures at once, although you can assign values to the individual members with the CEXPRESSION command.


Is the name of the symbol being added. The name must start with an alphabetic character or an underscore, optionally followed by alphabetic or numeric characters or underscores. The symbol name must not already exist (when appropriate, use the DELETE command to remove a symbol).


Is the address in target memory that is referred to by this debugger symbol. If you do not specify an address, the new debugger symbol refers to a location in debugger memory, and is not available to code running on the target.


Is the initial value of the added symbol. You can use:

  • integer values corresponding to the C types int, char, short, long or long long

  • pointers to integers in target memory

  • strings in double quotation marks, matching the character array type, char[n], but not char *

  • a list of values separated by a comma.

If the symbol type is a pointer, an assigned value must be the address of the value on the target.

You can initialize array symbols using multiple value arguments. For example:

> add char names[3][2] ="aa", "bb"
> print names[1]

The ... after bb indicates that there is no terminating NUL for the string, because each element of the array is only 2 characters in size.

The value is loaded into the memory location referred to by the symbol. If value is not specified, the symbol is set to zero in debugger memory but is not given a value in target memory.

Floating-point values are not recognized.


The ADD command adds a symbol to the debugger symbol table for the current connection. You cannot add a symbol without a connection, but you do not have to load an executable image file. If you then load an image, the symbol is destroyed. However, the symbol survives an executable image being reloaded (for example by selecting Target → Reload Image to Target from the Code window main menu) but is destroyed if the target is disconnected and then reconnected or another, different, image is loaded.

You can remove a symbol defined using ADD by using the DELETE command, and you can modify its value using the CEXPRESSION command.

Rules for the ADD command

The following rules apply to the use of the ADD command:

  • ADD runs asynchronously unless in a macro.

  • The specified symbol must not exist at the time it is added.

  • To change the symbol type, delete the symbol and then add it again.

  • When initializing symbols, the size of the symbol is used, not the size of the type of value supplied. In particular, the size of a char array is not determined by the string used to initialize it.

  • If a char array is created, for example using ADD char namearray[n], it is filled with the initial value.

  • If there is a runtime error in the initial value, the symbol is still created. You can then assign the correct value with the CEXPRESSION command, or you can delete the symbol and add it again with a legal initial value.


The following examples show how to use ADD:

add mysymbol =-3

Adds a new symbol called mysymbol of type int, which is signed, to the debugger symbol table.

add unsigned long ul=1234567890

Adds a new symbol called ul of type unsigned long to the debugger symbol table.

add char *xyz

Adds a new symbol called xyz to the debugger symbol table. The new symbol is of character pointer type and has an initial value of zero.

See also

Copyright © 2002-2011 ARM. All rights reserved.ARM DUI 0175N