How to display Symbian strings and descriptors in Visual C++ debugger
20 Jan 2004 - 15:34

Currently, using Visual Studio is a little bit painful when you deal with descriptor since you cannot directly display their content (you have to use the memory window). Here is a little trick that will allow you to display clear content of Symbian descriptors.

For this, you will have to take benefit of a feature of Microsoft Visual Studio called "Auto Expand". It allows the debugger to specify rules to display the content of custom data. This feature can be configured manually by editing the AutoExp.dat file which is located by default in C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin)

Open this file in your favorite text editor, copy/paste the following text at the end of it:

;=======================================================
;
; Symbian Strings & Descriptors
;
;=======================================================
TDes16=<,t> length=<iLength> max=<iMaxLength>
TDesC16=<,t> length=<iLength>
TPtr=length=<iLength> max=<iMaxLength> ptr=<iPtr+2,su>
TPtr16=length=<iLength> max=<iMaxLength> ptr=<iPtr+2,su>
TPtrC=length=<iLength> ptr=<iPtr,su>
TPtrC16=length=<iLength> ptr=<iPtr,su>
TBuf<*>=length=<iLength> max=<iMaxLength> buf=<iBuf,su>
TBufC<*>=length=<iLength> buffer=<iBuf,su>
HBufC16=length=<iLength> buffer=<iBuf,su>
TLitC<*>=length=<iTypeLength> buf=<iBuf,su>

TDes8=<,t> length=<iLength> max=<iMaxLength>
TDesC8=<,t> length=<iLength>
TPtr8=length=<iLength> max=<iMaxLength> ptr=<iPtr,s>
TPtrC8=length=<iLength> ptr=<iPtr,s>
TBuf8<*>=length=<iLength> max=<iMaxLength> buffer=<iBuf,s>
TBufC8<*>=length=<iLength> buffer=<iBuf,s>
HBufC8=length=<iLength> buffer=<iBuf,su>
TLitC8<*>=length=<iTypeLength> buffer=<iBuf,s>

TFileName= <iBuf,su>
TFullName= <iBuf,su>

Re-start the environment, put a breakpoint or two, start the debugger, and here you are....

desc-display.png

Isn't it nice ?

Tutorial posted January 20th, 2004 by eric

Submitted by Hugo (not verified) on Tue, 2004-01-20 16:15.

See this link as well for more stuff like that: http://www.emccsoft.com/devzone/tools/devstudio.html

Submitted by Anonymous on Tue, 2005-08-16 22:58.

How to create a TDesc object from a jstring variable passed from the Java program. The jstring variable holds a filename that is required to be passed to a function which takes the name of the file as a TDesc. Pls help.

Submitted by M (not verified) on Mon, 2004-01-26 13:25.

great trick, thanks Eric!

Submitted by xuantl (not verified) on Tue, 2004-02-17 02:32.

Helpful ! Thanks !

Submitted by Reza (not verified) on Tue, 2005-03-01 05:17.

Hi there,

I have a question about buffer and strings. I have a buffer like TBuf <20> test...and I want to extract and test each charachter in this buffer. I am using MID function and constructing a pointer like " TPtrC16 P1=test.Mid(xx,yy);" where xx=0 and yy=1. My question is how I can compare each character of this array with one byte. like if ( P1[0] == "T" ) then do something.

I really appreciate if you can help me out. Regards, Reza


Submitted by Vikas (not verified) on Tue, 2005-03-08 14:09.

Very Easy.. Just see following code.(it really works..)

TBuf<20>buf; buf.Copy(_L("Hello World")); Tbuf<20>buf2; for(i=0;i char ch=buf[i]; //buf[i] will return character at ith place buf2.Append(ch); //Now buf2 will also contain Hello World


Submitted by leo (not verified) on Mon, 2005-11-07 14:14.

i have to compare the valu of TBue with a char how can i do that please help me in that.


copyright 2003-2009 NewLC SARL