[Pyobjc-dev] Better way to use gdb.
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2002-10-17 14:22:31
|
Paste this into the main file just before the call to execve(). if ([[[NSProcessInfo processInfo] environment] objectForKey: @"SHOWPID"]) NSLog(@"Process ID is: %d (\n\tgdb %s %d\n to debug)", getpid(), pythonBinPathPtr, getpid()); Then, set the SHOWPID environment variable to some random value. Upon launch, the app will spew something like: 2002-10-17 09:48:46.366 Intent[14992] Process ID is: 14992 ( gdb /usr/bin/python 14992 to debug) Copy/paste the command line (middle line) into Terminal. You can also add a custom executable to the PBX project -- set the executable to /usr/bin/python. You also have to write the following default to cause Project Builder's gdb module to not autolaunch the target executable on launch (or else you'll end up debugging the generic Python interpreter!). defaults write com.apple.ProjectBuilder PBXDebuggerAutoRun NO Once the app is launched and spews the output shown, you can type 'attach 14992' (or whatever the PID is) to attach gdb to the appropriate process. When gdb attaches to the process, it'll automatically load any shlibs and other symbol tables. It will also stop the process -- use the continue command to continue the execution of the inferior process. b.bum |