[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HOWTO: debug pserver

From: Peschko, Edward
Subject: HOWTO: debug pserver
Date: Wed, 4 Jun 2003 13:59:00 -0700

Ok, I went through the ordeal of debugging pserver (with gdb) and didn't find a 
good hit 
whilst searching through google, so I offer the following instruction guide to 
debugging the client/server 
interaction via gdb (thanks larry jones for pointers):

1) Open up two windows for gdb, one for the server, one for the server's child 
    (you are going to attach to it later). Set CVS_SERVER_SLEEP to 60 so you 
    attach to the child process later (the one that is going to do all the 

2) Mirror a cvs directory (ie: copy it) 

3) run the cvs command that you want to debug or trace with CVS_CLIENT_LOG, 
    against the copied cvs tree. Note that you need to use a cvs tree with 
    not :ext.

4) you will get a file that looks like:

        Root /dbs/dat/cvs
        Valid-responses ok error ........ etc
        Argument -m
        Argument asdf
        Directory .

5) from the server gdb, do a 'r server < $'

6) in the child gdb, do a 'shell ps -ef | grep cvs' - you should get two 
    one server, one child.

7) Attach to the child. and start debugging. A good place to set a breakpoint 
is the
    line 'exitstatus = (*command) (argument_count, argument_vector);' (line 
2787 in 1.11.5)

Caveats: Note that follow-fork-mode child does *not* work, nor does debugging 
code after the fork (it causes an ABRT signal ). Note also that there will be a 
between the debugging and the real world because the above will only output 
what happens
to stderr, and not actually apply any of the changes to the cvs tree. I'm not 
sure how you'd do
the above in daemon mode, or how you can use the output from the server, and 
redirect it
to a cvs client call (in gdb). Perhaps someone could elaborate?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]