How to display Symbian strings and descriptors in Visual C++ debugger

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 ?


> How to display Symbian strings and descriptors in Visual C++ d

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

> How to display Symbian strings and descriptors in Visual C++ d

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.

> How to display Symbian strings and descriptors in Visual C++ d

great trick, thanks Eric!

> How to display Symbian strings and descriptors in Visual C++ d

Helpful ! Thanks !

> How to display Symbian strings and descriptors in Visual C++ d

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

> How to display Symbian strings and descriptors in Visual C++ d

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

> how can i compare TBuf with a character?

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