• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to debug BetterAuthorizationSample
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to debug BetterAuthorizationSample


  • Subject: Re: How to debug BetterAuthorizationSample
  • From: Greg Guerin <email@hidden>
  • Date: Fri, 17 Jul 2009 13:01:23 -0700

Eric Gorr wrote:

It is launched from my main application, but I now have a need to set a breakpoint and debug this tool and I am not certain how to get the Xcode debugger to stop once the tool has been launched.

Can anyone provide some guidance on how this is possible?

When I've done this in the past, I wrote the tool to stop itself if a particular environment-variable is set. That gives me a chance to attach the debugger, set breakpoints, etc.


Pick any distinctive env-var name you like. I usually chose something like "PAUSE_x" where x is the name of the tool itself. Recall that argv[0] is the pathname of the executable, and this can be dynamic. Also, you can set the env-var in the plist of the parent app, and it will be inherited. Man page: man 3 getenv

To pause the process, the simplest is sleep(100). Man page: man 3 sleep.

One can also pause a process by sending it the SIGSTOP signal. Sending it to self would be kill( getpid(), SIGSTOP ). Man pages: man 2 kill, man sigaction.

The advantage of SIGSTOP is it can be reversed by sending a SIGCONT signal from another process, and it applies to the entire process, where sleep() only applies to the calling thread.

  -- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: How to debug BetterAuthorizationSample
  • Next by Date: Re: How to debug BetterAuthorizationSample
  • Previous by thread: Re: How to debug BetterAuthorizationSample
  • Next by thread: cgdb instead of gdb (or sudo gdb)
  • Index(es):
    • Date
    • Thread