The GDB script \epoc32\gcc\share\epoc-des.ini
defines a new command epoc-print-des16 that can be used to display type, length and content information about a given descriptor. More information about the command, and its shorter alias pd16, is provided in the Symbian specific GDB command reference.
Before using the new command, the script must be loaded into GDB. Note that this need only be done once every debugging session, and may be incorporated into the GDB initialisation file.
To add the script into GDB and to print the contents of a descriptor:
Add the GDB script for descriptor debugging into GDB.
The GDB source command is used to add the descriptor GDB script. For example, if x is the root of the SDK installation:
source //x/shared/epoc32/gcc/share/epoc-des.ini
The command may be used at the (gdb) command prompt or in the Insight console. However it is more usual to include the command within the gdb.ini
initialisation file so that it doesn't have to be invoked for every debugging session.
At the (gdb) command prompt, or in the Insight console, enter:
epoc-print-des16 DescriptorName
or
pd16 DescriptorName
Note:
It is not possible to use this command to debug the contents of a literal descriptor.
Use help epoc-print-des16 at the (gdb) command prompt to get more information about the command.
Printable ASCII characters are printed directly — except the double quote character which is printed prefixed by a backslash. Other characters are printed as \uXXXX where XXXX is an hexadecimal number.
Given the following set of descriptors:
TBufC16<32> bufC16(_L16("UNICODE STRING"));
TText16 a16[] = { 'h', 'e', 'l', 'l', 'o', 3, 127, '"', 0x666 };
TPtr16 ptr16(a16, sizeof a16/2, sizeof a16/2);
Below is a transcript showing how the descriptors are debugged within a GDB session:
(gdb) epoc-print-des16 bufC16
Type: TBufC16 or HBufC16
Length = 14
Content = "UNICODE STRING"
(gdb) pd16 ptr16
Type: TPtr16
Length = 9
Content = "hello\u0003\u007F\"\u0666"