Xcode 4.1 自定义 DataFormatter 捆绑包
我正在尝试制作一个自定义数据格式化程序包,以允许我更漂亮地打印 STL 容器等内容。
我已尽力按照在线说明进行操作,但是我似乎无法获得任何捆绑要运行的代码。我所能做的就是让 Xcode 在我的数据格式化程序复制到 /Developer/Library/Xcode/CustomDataViews/ 时显示“Summary Unavailable”
我使用 Xcode 创建了我的包“bundle”模板,并将其放入我的 C++ 文件中:
#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;
}
Hi 对象是微不足道的:
#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;
};
我知道我的问题不在于我的 .plist 文件,因为如果我将以下内容放入 StringSummary 字段中,它将打印出字符串字段;
%string%:s
但是,如果我将其放入:(是的,我将其链接到 Hi * 对象,而不是 Hi 对象。)
{(char *)printHi($VAR, $ID)}:s
我能得到的只是摘要不可用。。我正在使用一个简单的项目进行调试:
#include "hi.h"
void foo( Hi * obj ) {
obj->print();
}
int main( void ) {
Hi h( "test!" );
foo( &h );
return 1;
}
有人对调试调试器有任何提示吗? :P
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 object 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有产品>调试>共享库 - 您应该检查您的包是否已加载。
另外,您似乎可以使用当前运行目标中的任何函数 - 但 _pbxgdb_plugin_function_list 变量此时似乎为 NULL。
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.