2

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:

  1. mountain lion + xcode 4.6/4.6 + manually compiled valgrind + SDK5.1 extracted from older version of xcode.
  2. lion(10.7.5) guest os in a vmware (host is mountain lion) + xcode4.3.2/4.5.2 + SDK5.1/SDK5.0
  3. 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;
}
fluke
  • 660
  • 8
  • 16

1 Answers1

0

I've gotten this to work, but I had to hack the crud out of Valgrind, because some of the SSE4 instructions emitted by LLVM were not supported under valgrind's emulator at that point. I believe I've still got a version of this some place if you're still interested. Oh, also, you need to disable any and all audio or video code, because your audio threads will time out (Valgrind is just that slow) and the simulator will quit.

Mark Pauley
  • 1,445
  • 12
  • 11