Activating process servers and connecting to them

The mechanisms used to activate a process server are fairly similar to those used to work with the -server and -remote remoting mechanism.

To start a process server, you must use a special utility called dbgsrv.exe that is distributed with DTW.  This program is the server end of debugger connection.

Like -server and -remote, process server / smart client debugging uses connection strings for both the client and the server.  The syntax for client and server connection strings are for the most part compatible, so you should look back on my existing posts about basic remote connectivity, reverse connections, and securing debugger connections.  For the most part, things work exactly the same as -server and -remote; all of the connectivity options supported by -server and -remote work for process servers and smart clients, and all of the features (such as reverse connections and secured connections) are available using the same mechanisms as well.

The main differences are how you pass the connection string to dbgsrv.  Where you would previously use “-server connection-string“, you will use “-t connection-string” with dbgsrv.  For instance, an example command line would be:

dbgsrv.exe -t tcp:port=port,password=password

To connect to this process server, you can use the “-premote” parameter with a debugger client (NTSD, CDB, and WinDbg).  This parameter functions in the same way as “-remote”, except that it is for connecting to process servers and not -server-style remote debugging servers.

debugger -premote tcp:port=port,server=server,password=password

Note that if you are using NTSD or CDB, you will need to specify a pid to connect to (e.g. -p pid) on the command line as well.  This is because a process server is not just fixed on one target process, but allows you to debug any process it has permissions to debug on the remote system.  With WinDbg, you can just open the process list (e.g. F6) like you would with a local system, and you will be presented with a list of running process to debug on the remote system.

After the connection is established, you can continue to debug as if you were running the debugger directly on the remote system.  Remember that with process servers, things like symbol access and extension dll calls are actually performed by the client debugger and not the remote system.  This means that if you set the symbol path, you are setting the symbol path for your debugger and not the process server (which has no concept of a symbol path).  As a result, your system will be the one to access symbol repositories and not the remote system.

The important thing to remember about process servers is that unlike the other remote debugging mechanisms that I have discussed thus far, process servers provide you with an entire “view” of the remote system and not just a remote view of a single debugging session.  This is in effect widening the scope of the remote debugging session from just one target to any programs running on the target system.

5 Responses to “Activating process servers and connecting to them”

  1. dispensa says:

    This continues to be a great series. Are you planning on an executive summary style wrap-up at the end perchance?

  2. Vipin says:

    I feel visual studio debugger is friendly for remote debugging. Have you used it?


  3. Skywing says:

    I haven’t used VS for serious debugging work since VC6 before VC7 came out. As far as allowing you to do complicated debugging tasks goes, I think that WinDbg/ntsd/cdb provide a superior experience once you get used to using them. Plus, there’s the ability to easily extend the debugger yourself to automate common tasks.

    The DTW package is also much less of a pain to setup if you want to do local debugging on a test virtual machine or something of that sort, where installing VS is not really practical.

  4. […] Nynaeve Adventures in Windows debugging and reverse engineering. « Activating process servers and connecting to them […]

  5. […] Activating process servers and connecting to them […]

Leave a Reply