Re: Routine viewing of specific values of a complex data structure in the debugger
Re: Routine viewing of specific values of a complex data structure in the debugger
- Subject: Re: Routine viewing of specific values of a complex data structure in the debugger
- From: John Clements <email@hidden>
- Date: Thu, 27 May 2004 04:19:33 +1000
Chris,
Thanks very much for getting back to me about displaying data in the
debugger. It's a really impressive feature of XCode. To round out this
thread, I'd like to spell out my problem and the solution, incase this
case study is helpful to others on the list.
I have a class, QString, with a complex structure. For every instance,
I want the debugger to display the char* that is returned by a class
method named "latin1()".
Old laborious method: bring up an expressions window and type in
something like myQString.latin1()
Great new method suggested by Chris: In the Summary field of myQString,
type...
{$VAR.latin1()}:s
The curly brackets tell XCode this is an expression.
$VAR is replaced by the variable FOR EVERY QString!!
I'm not 100% sure what ':s' means - format the result for the 'Summary'
column, perhaps? Anyway it works very nicely (so far).
Thanks again,
John.
On 26/05/2004, at 3:04 PM, Chris Espinosa wrote:
On May 25, 2004, at 7:29 PM, John Clements wrote:
I am using a framework that has a very nice string class (QString). It
handles Unicode strings, and provides lots of handy utilities. Only
problem is that is awkward to monitor the current value of a QString
in
the debugger. One solution is to type "theTitle.latin1()" into the
debugger's expression evaluator (where 'theTitle' is a QString - see
attachment). The other solution is to burrow down into the structure
to
find the 'ascii' field of the string class. Both approaches are
awkward and time consuming during intensive debugging. Can anyone
suggest an XCode technique to simplify routine viewing of the value of
a specific field in a complex structure? Perhaps I need to sub-class
QString?
If your debugger is showing the "Summary" field and you have Custom
Data Display turned on in the Debug menu, you can enter your
expression right into the Summary field and it will be evaluated for
every variable of that type. Expressions you enter are saved (on a
per-user basis) so you don't have to reenter them; you can also
prepare a description file of ones you want to use consistently and
put it in /Library/Application Support/Apple/Developer
Tools/CustomDataViews and it'll be used for all projects.
Check the Foundation viewers in that folder of an example on how to
write the viewers. There's a symbol in each expression that gets
substituted with the variable being viewed.
Chris Espinosa
Apple
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.