Re: Customizing variable's summary
Re: Customizing variable's summary
- Subject: Re: Customizing variable's summary
- From: Jim Ingham <email@hidden>
- Date: Tue, 11 Nov 2003 11:05:46 -0800
On Nov 11, 2003, at 8:33 AM, Randy Croucher wrote:
Thank you very much, I've been playing with it this morning. Looks
kind of cool. I will experiment with writing a bundle next.
This can be very powerful, but you need to exercise a bit of caution in
writing these plugins.
Remember that this code will be running in the context of your target
program, so you shouldn't do anything that changes state.
You also should try to be fault tolerant. For instance, the code you
are breaking in might do something like:
int myFunc ()
{
MyClass *foo;
// Some code
foo = new MyClass (5);
// Some more code
}
If you break in the "// Some code" section, then foo is not going to be
valid yet, but Xcode has no way of knowing that, so we will still call
your data formatter. If the data formatter function crashes with an
access violation, that is okay, gdb can clean up after the call and
return the program to its previous state. But you should be careful
that this is the worst that will happen...
You should also avoid doing malloc's because you can't guarantee that
somebody doesn't have the malloc lock on another thread. More
generally you should avoid trying to acquire any locks, since they
could be held already, and running your data inspector would then cause
a deadlock.
Do you know if there is a way to turn off the displaying of "public",
"private" and "protected" entries in the variables column for C++
classes? This seems like a waste of space for me, and not something I
generally care about during debugging.
No, there isn't any way to suppress these at present.
Jim
Randy Croucher
You are likely referring to the custom data formatters, a feature in
Xcode which allows developers to customize the information displayed
for variables in the debugger data view. Simple, customized
expressions can be entered directly into the GUI using a simple
format string -- you can find more information on this in the help
document "Viewing Variables and Expressions", which can be found by:
1) Opening Xcode
2) Selecting "Xcode Help" under the "Help" menu
3) In the window that comes up, select the "Debugging" link on the
left-hand side of the "Xcode Help" document
4) From the nested content that appears beneath the "Debugging" link
(after clicking on it) select "Viewing Variables and Expressions"
5) From that page, scroll down to the "Using Custom Data Formatters
to View Variables in the Debugger" section
Or, you can just open the file directly at:
file:////Developer/Applications/Xcode.app/Contents/Resources/
English.lproj/Xcode_Help/Debugging/chapter_8_section_9.html
For types which require more complex processing, a mechanism for
writing a plugin bundle to generate descriptions for variables has
been provided. For developers interested in exploring this feature,
some interim documentation is located in the file
'DataFormatterPlugin.h', which resides inside the Xcode application
bundle
(/Developer/Applications/Xcode.app/Contents/PlugIns/
GDBMIDebugging.pbplugin/Contents/Headers/DataFormatterPlugin.h).
Hope that helps.
- matthew
On Nov 10, 2003, at 8:37 PM, Randy Croucher wrote:
I thought I had seen an article about how to add your own custom
"Summary" to your variable types. Like when you have a variable of
type WindowRef and the Summary column in the debugger says
'title="Window" index=0'. I would like to do this for a few of my
classes.
Randy Croucher
_______________________________________________
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.
_______________________________________________
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.
--
Jim Ingham email@hidden
Developer Tools
Apple Computer
_______________________________________________
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.