|
From: | Mike Ayers |
Subject: | Re: CVS server debugging |
Date: | Sat, 19 Oct 2002 17:02:10 -0700 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 |
Dan Peterson wrote:
Is there a way to start the CVS server (pserver) so it can be run through gdb?
From inetd? I should hope not. This would (I believe) imply a rather serious security gap in inetd.
I want to be able to debug the server process from the very beginning, but the best I can do is after inetd has forked off the cvs server process I can attach to the process with gdb using the PID. Problem is, this is after the point where I need to debug... and the process usually doesn't last long enough to attach to it anyway.
Stupid debugging trick: set your own breakpoint. Immediately before the statement at which you would like to start debugging, insert:
while ( 1 == 1 ) ;...build, and replace your existibg executable. When you attach, it will be holding right at the point of interest. You will be able to safely move the PC to the statement immediately following the infinite loop, thus allowing the program to execute as if it were never stopped.
If you must debug in a live environment (obcaveat: avoid if possible), then inserting a 10 second sleep instead of an infinite loop should do the trick nicely (helpful suggestion: send an ALL CAPS email ten minutes (or so) before installing the sleeping program so that your developers do not think that the server is broken when every command takes ten seconds minimum to complete).
Maybe not what you wanted, but it works pretty well. /|/|ike
[Prev in Thread] | Current Thread | [Next in Thread] |