Re-use the libxml debugger plugin

Repository details
You can access the repository via CVS anonymous access

How to setup Xcode

An excellent page on how to setup Xcode with sourceforge is found at http://www.physics.emory.edu/students/davidheiser/sourceforge.html

You don't have todo the import, just checkout the modulename: xcodexml2

Open the project

Now open the xcode project. This gives you a single main.c file. This contains the implementation of the formatters. They are defined in another file, CustomDataViews.plist. You can see that as the function declarations for XCode to know what to call. (The format of this plist is the same as the customization plist.

If someone know how to checkout directly from Xcode, please let me know via terranvs at sourceforge

Create your own plugin

Developers can create a bundle which contains functions they write themselves to construct display strings. The bundle must also contain a file resource named CustomDataViews.plist, which is the plist containing format strings. Whenever a formatter string from the bundle's .plist is used, Xcode ensures that the bundle code is loaded into the process being debugged. The expressions in the format strings can contain calls to functions in the bundle. The functions you write should be as lightweight as possible because they will be evaluated after every step in the debugger. Additionally they should not modify any global state in the process. And they must be carefully written to avoid causing problems when presented with uninitialized variables. gdb can typically handle the case where a function called from an expression causes a crash, but it is good to be as prudent as possible.

A bundle to support custom data formatting must define the following symbol:

 _pbxgdb_plugin_function_list *_pbxgdb_plugin_functions = NULL;
 

This must be defined as a global symbol in the bundle. The bundle is loaded using NSLINKMODULE_OPTION_PRIVATE, so this symbol (and any other globals) are not merged into the global symbol table of the program. When the bundle is loaded the loading code looks up this symbol by name and fills in a value. This allows the plugin to use utility functions which are already present in the debugging environment without requiring that the linker be informed of them. These functions are described below. (Note that bundle initializer functions are called before this value is filled in.)