X-Spam-Check-By: sourceware.org Date: Wed, 4 Jan 2006 22:52:52 -0500 (EST) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: Brett Serkez cc: cygwin AT cygwin DOT com Subject: Re: services not starting with 20060104 snapshot In-Reply-To: <1136427122.29514.251115414@webmail.messagingengine.com> Message-ID: References: <20060104125229 DOT GA3376 AT efn DOT org> <43BC2659 DOT 9060709 AT acm DOT org> <20060104203344 DOT GA18306 AT trixie DOT casa DOT cgf DOT cx> <1136421144 DOT 30911 DOT 251110210 AT webmail DOT messagingengine DOT com> <1136427122 DOT 29514 DOT 251115414 AT webmail DOT messagingengine DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Wed, 4 Jan 2006, Brett Serkez wrote: > > > Try using a graphical debugger like ddd or insight. Should be able > > > to start either as the service, > > > > Huh? No, that doesn't work. I need a service wrapper program (like > > cygrunsrv), but cygrunsrv can't spawn processes, apparently. > > I see. While I've not used this method with services per se, I've used > it with other background processes, didn't foresee the service_main. > > You should be able attach to the running service process with gdb, from > the manual: > > You can, instead, specify a process ID as a second argument, if you > want to debug a running process: > > gdb(1,4) program 1234 > > The trick is where will the program be when you attach. To resolve > this, code *like* the following can be inserted just prior to the > point you want to start debugging: Thank you, I'm well aware how to use gdb. I also know how to insert breakpoints into the compiled code (no need for an infinite loop, BTW -- Cygwin has its own mechanisms). > { > int a = 1; > > while ( a ) ; > > } > > When you gain control you will be in the while, assign a value of 0 > to a and then start stepping thru the remaining code. However, the trick is that there is *no* running service process for gdb to attach to -- by the time I'm able to fire off gdb, the cygrunsrv process is wa-ay past the point where it tries to fork off the daemon. If it were that simple, I would have already done this. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac" -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/