refer to http://alxsrg.com/?p=180 http://root42.blogspot.ru/2011/02/valgrind-checking-of-ios-programs.html and http://landonf.bikemonkey.org/code/iphone/iPhone_Simulator_Valgrind.20081224.html .
I have tried in some situations, all fails.
All I try are:
- mountain lion + xcode 4.6/4.6 + manually compiled valgrind + SDK5.1 extracted from older version of xcode.
- lion(10.7.5) guest os in a vmware (host is mountain lion) + xcode4.3.2/4.5.2 + SDK5.1/SDK5.0
- lion (10.7) + xcode4.2.1 + SDK5.0
the execl is fail with a stack of null instruction ( 0x00000000).
while i have tried to use valgrind in command line and works well.
ps, the code spawn valgrind in the simulator:
#define VALGRIND "/opt/local/bin/valgrind"
int main(int argc, char *argv[]) {
#ifdef VALGRIND_REXEC
/* Using the valgrind build config, rexec ourself
* in valgrind */
if (argc < 2 || (argc >= 2 && strcmp(argv[1], "-valgrind") != 0)) {
execl(VALGRIND, VALGRIND, "--leak-check=full", argv[0], "-valgrind",
NULL);
}
#endif
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"PeepsAppDelegate");
[pool release];
return retVal;
}