Re: Displaying Custom Data Types in Debugger
Re: Displaying Custom Data Types in Debugger
- Subject: Re: Displaying Custom Data Types in Debugger
- From: Chris Espinosa <email@hidden>
- Date: Sat, 16 Jul 2005 13:40:02 -0700
On Jul 16, 2005, at 11:52 AM, Michael Rice wrote:
Thank you. I have one more question about this feature. I have an
unicode string (an array of 16-bit unsigned shorts) that I would like
to display as a char*. I know that each character is ASCII (the
unsigned short value is <= 255). Is there a simple way to do this?
The Xcode documentation states:
"In addition to supplying custom format strings to display variables
in the debugger, you can also write your own code that constructs
descriptions for variables displayed in the debugger. These functions
can be packaged as a bundle that is loaded into the process being
debugged. These functions can then be invoked from format strings."
Is this what I need to do? If so, is there an example of how to do
this?
Take a look at
/Developer/Applications/Xcode.app/Contents/PlugIns/
GDBMIDebugging.xcplugin/Contents/Headers/DataFormatterPlugin.h
and /Library/Application Support/Apple/Developer
Tools/CustomDataViews/CarbonDataFormatter.bundle
You write a simple .c file that #includes "
/Developer/Applications/Xcode.app/Contents/PlugIns/
GDBMIDebugging.xcplugin/Contents/Headers/DataFormatterPlugin.h", and a
function that returns a char * given a pointer to your Unicode string.
Compile that into a plugin that's structured like the
CarbonDataFormatter.bundle, and put in the plist the expression that
calls your function.
Because to return a char * from your Unicode string you probably have
to allocate memory temporarily, you use the ID passed in the expression
and pass it to the _pbxgdb_allocator(size, ID) function to allocate
space for the char *. Xcode will free this memory when your variable
goes out of scope.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden