I'm trying to make a custom Data Formatter bundle to allow me to print things like STL containers more prettily, etc.
I've followed the instructions online as well as I can, however I can't seem to get any bundle code to run. All I can do is get Xcode to say "Summary Unavailable" when my data formatter is copied to /Developer/Library/Xcode/CustomDataViews/
I created my bundle with the Xcode "bundle" template, and have put this into my C++ file:
#include "/Developer/Library/Xcode/PrivatePlugIns/DebuggerFoundation.ideplugin/Contents/Headers/DataFormatterPlugin.h"
#include "Hi.h"
_pbxgdb_plugin_function_list *_pbxgdb_plugin_functions = NULL;
char * printHi( Hi * obj, int Id) {
char * result = (char*)(_pbxgdb_plugin_functions->allocate(Id,100));
sprintf( result, "%s", obj->string );
return result;
}
Where the Hi obj开发者_JAVA百科ect is trivial:
#include <stdio.h>
#include <string.h>
class Hi {
public:
Hi( char * str ) {
string = new char[strlen(str)+1];
strcpy( string, str );
}
~Hi() {
delete( string );
}
void print( void ) {
printf( "%s", string );
}
char * string;
};
I know my problem isn't with my .plist file because if I put the following in the StringSummary field, it will print out the string field;
%string%:s
However, if I put this in: (Yes, I am linking this to a Hi * object, not a Hi object.)
{(char *)printHi($VAR, $ID)}:s
All I can get out is Summary Unavailable. I'm debugging with a simple project:
#include "hi.h"
void foo( Hi * obj ) {
obj->print();
}
int main( void ) {
Hi h( "test!" );
foo( &h );
return 1;
}
Anybody got any tips for debugging debuggers? :P
There is Product > Debug > Shared Libraries - you should check if your bundle is loaded at all. Also it seems you can use any functions from currently running target - but _pbxgdb_plugin_function_list variable seems to be NULL at that point.
精彩评论