问题描述
在使用valgrind运行iOS 4.2应用程序时出现问题。
我从Macports安装了valgrind 3.6.0-SVN。 XCode 3.2.5。
当我修改我的main()运行valgrind我得到以下输出:
检测到在iPhone上不存在的系统库中调用符号的尝试:
open $ UNIX2003从函数_vgrZU_libSystemZdZaZddylib_arc4random调用映像vgpreload_core-x86-darwin.so 。
如果您在gdb中运行模拟器二进制文件时遇到此问题,请确保首先将start-with-shell设置为off。
== 99640 ==
== 99640 ==使用信号6(SIGABRT)的默认动作进程终止
== 99640 ==在0x8B5DEF6:__kill(in / usr /lib/libSystem.B.dylib)
== 99640 == by 0x8BF062C:raise(in /usr/lib/libSystem.B.dylib)
== 99640 == by 0x8C066E3:abort(in /usr/lib/libSystem.B.dylib)
== 99640 == by 0x33F2547:__springboard_unimplemented(在/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem中.dylib)
== 99640 == by 0x33FC208:open $ UNIX2003(在/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem.dylib中)
== 99640 == by 0x1AAD6F3:arc4random(vg_preloaded.c:163)
== 99640 == by 0x8AFFB7E:create_scalable_zone(in /usr/lib/libSystem.B.dylib)
== 99640 == by 0x8AFF7EA:_malloc_initialize(in /usr/lib/libSystem.B.dylib)
== 99640 == by 0x8B23449:malloc_create_zone(in /usr/lib/libSystem.B.dylib)
= = 99640 == 0x8B233F8:_dispatch_c cache_init(在/usr/lib/libSystem.B.dylib中)
== 99640 == by 0x8B21E0D:dispatch_once_f(in /usr/lib/libSystem.B.dylib)
== 99640 ==由0x8B233D3:_dispatch_continuation_alloc_from_heap(在/usr/lib/libSystem.B.dylib中)
错误似乎很清楚。如何解决这个问题?我听说过在SDK 3.x上运行valgrind的成功尝试。有什么变化?
任何其他建议?
一个可怕的黑客,我不知道这是什么意思...但它确实解决了这个问题:
在你的valgrind源代码中,打开vg_preloaded.c并找到第163行(在您的堆栈跟踪中引用)。更改那里的代码:
/ * if(rnd< 0)rnd = open(/ dev / ,O_RDONLY);
read(rnd,& result,sizeof(result)); * /
result = random();
这似乎是使valgrind不工作的唯一的事情...你的里程可能会有所不同。 / p>
Having problems running iOS 4.2 apps with valgrind.
I installed valgrind 3.6.0-SVN from Macports. XCode 3.2.5.
When I modify my main() to run valgrind I get the following output:
Detected an attempt to call a symbol in system libraries that is not present on the iPhone: open$UNIX2003 called from function _vgrZU_libSystemZdZaZddylib_arc4random in image vgpreload_core-x86-darwin.so. If you are encountering this problem running a simulator binary within gdb, make sure you 'set start-with-shell off' first. ==99640== ==99640== Process terminating with default action of signal 6 (SIGABRT) ==99640== at 0x8B5DEF6: __kill (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8BF062C: raise (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8C066E3: abort (in /usr/lib/libSystem.B.dylib) ==99640== by 0x33F2547: __springboard_unimplemented (in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem.dylib) ==99640== by 0x33FC208: open$UNIX2003 (in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/libSystem.dylib) ==99640== by 0x1AAD6F3: arc4random (vg_preloaded.c:163) ==99640== by 0x8AFFB7E: create_scalable_zone (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8AFF7EA: _malloc_initialize (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8B23449: malloc_create_zone (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8B233F8: _dispatch_ccache_init (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8B21E0D: dispatch_once_f (in /usr/lib/libSystem.B.dylib) ==99640== by 0x8B233D3: _dispatch_continuation_alloc_from_heap (in /usr/lib/libSystem.B.dylib)
The error seems to be pretty clear. How can I fix this? I've heard of successful attempts running valgrind on SDK 3.x. What has changed?
Any other advice?
This is a hideous hack, and I have no idea what the implications are... but it did solve the problem:
In your valgrind source, open up vg_preloaded.c and find line 163 (referenced in your stack trace there). Change the code that is there to:
/* if (rnd < 0) rnd = open("/dev/random", O_RDONLY);
read(rnd, &result, sizeof(result)); */
result = random();
This appears to be the only thing that keeps valgrind from working... Your mileage may vary.
这篇关于valgrind和iOS SDK 4.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!