{"id":37,"date":"2006-07-31T10:58:35","date_gmt":"2006-07-31T15:58:35","guid":{"rendered":"http:\/\/www.nynaeve.net\/?p=37"},"modified":"2019-12-13T17:41:40","modified_gmt":"2019-12-13T22:41:40","slug":"remote-debugging-with-kdsrvexe","status":"publish","type":"post","link":"http:\/\/www.nynaeve.net\/?p=37","title":{"rendered":"Remote debugging with kdsrv.exe"},"content":{"rendered":"<p>Most of the debugging mechanisms I have gone through so far will also support kernel debugging, though I have not focused on this fact.\u00c2\u00a0 You can use <a title=\"Remote debugging with remote.exe\" href=\"http:\/\/www.nynaeve.net\/?p=19\">remote.exe<\/a>\u00c2\u00a0for controlling KD remotely, and <a title=\"Remote debugging with -server and -remote\" href=\"http:\/\/www.nynaeve.net\/?p=31\">-server\/-remote<\/a>\u00c2\u00a0for controlling one KD through another KD or WinDbg.\u00c2\u00a0 Both of these mechanisms can be used to control a kernel debugger remotely (keep in mind that you still need a separate computer to run kd.exe on from the target computer of course), however, they do not allow the same flexibility as <a title=\"Remote debugging with process servers (dbgsrv)\" href=\"http:\/\/www.nynaeve.net\/?p=35\">dbgsrv.exe<\/a>\u00c2\u00a0does.\u00c2\u00a0 This means no\u00c2\u00a0client-side symbol access, and no client-side debugger extensions.<\/p>\n<p>However, there <em>is<\/em> a way to get this functionality with the kernel debugger as you would with the user mode debuggers when using dbgsrv.exe.\u00c2\u00a0 Enter kdsrv.exe, the kernel debugger server.\u00c2\u00a0 Kdsrv.exe is an analogue of dbgsrv.exe and fullfills the same basic functional requirements; it allows multiple debugger clients to connect to it and begin kernel debugging sessions on resources that are connected to the computer running kdsrv.exe.\u00c2\u00a0 Like dbgsrv.exe, kdsrv.exe is used with one debugger client per debugging session, and also like dbgsrv.exe, kdsrv.exe does not start any debugging sessions on its own and leaves that up to clients that connect remotely.\u00c2\u00a0 It also allows for secured connections and reverse connections, just like dbgsrv.exe (using the same connection string values).<\/p>\n<p>Kdsrv.exe allows the same rich experience as dbgsrv.exe when it comes to doing remote kernel debugging.\u00c2\u00a0 It allows you do perform symbol access and debugger extension calls on the local debugger client and not from a kd.exe instance running on the remote system.\u00c2\u00a0 It also\u00c2\u00a0has many of the same limitations of dbgsrv.exe, such as no support for remote dump file debugging.<\/p>\n<p>To activate a kdsrv.exe server, use the same syntax that I described with with &#8220;<a title=\"Activating process servers and connecting to them\" href=\"http:\/\/www.nynaeve.net\/?p=36\">Activating process servers and connecting to them<\/a>&#8220;.\u00c2\u00a0 The command options are identical to dbgsrv.exe with respect to specifying a connection string and starting the server (some of the little-used other command line options to dbgsrv.exe that relate to starting a process along with the debugger server are not supported by kdsrv.exe).\u00c2\u00a0 For example, you could use:<\/p>\n<pre>kdsrv.exe -t tcp:port=port,password=secret<\/pre>\n<p>You&#8217;ll get an error message box if you give kdsrv.exe an unacceptable command line, otherwise, it will simply run in the background.<\/p>\n<p>Connecting to a kdsrv.exe instance uses a slightly more complex connection string syntax, which is an adaptation of the one used by <a title=\"Activating process servers and connecting to them\" href=\"http:\/\/www.nynaeve.net\/?p=36\">smart clients<\/a>\u00c2\u00a0with -premote.<\/p>\n<p>The client connection string is given in the format:<\/p>\n<p>kdsrv:server=@{tcp:port=<em>port<\/em>,server=<em>server-ip<\/em>,password=<em>password<\/em>},trans=@{<em>kd-string<\/em>}<\/p>\n<p>(Password is optional.)<\/p>\n<p>The &#8220;kd-string&#8221; value is what you would normally pass to kd.exe or windbg.exe to start a kd session.\u00c2\u00a0 It specifies a remote resource to connect to that resides on the machine running kdsrv.exe.\u00c2\u00a0 For instance, you might use &#8220;com:port=<em>comport<\/em>,baudrate=<em>baudrate<\/em>&#8221; to direct kdsrv.exe to connect the kernel debugger over a com port connection using the specified baud rate.<\/p>\n<p>To activate a kdsrv.exe client, use a command line formatted as follows;<\/p>\n<pre>debugger -k <em>connection-string<\/em><\/pre>\n<p>, where &#8220;connection-string&#8221; is the &#8220;kdsrv:&#8230;&#8221; string discussed above.\u00c2\u00a0 Here are some examples of starting a server and connecting to it:<\/p>\n<p>Starting the kdsrv instance:<\/p>\n<pre>kdsrv.exe -t tcp:port=1234,password=secret<\/pre>\n<p>Connecting kd:<\/p>\n<pre>kd.exe -k kdsrv:server=@{tcp:port=1234,server=127.0.0.1,\r\npassword=secret},trans=@{com:port=com1,baudrate=115200}<\/pre>\n<p>After that, you should be set to go.<\/p>\n<p>You can use a variety of different underlying debugger targets with kdsrv.exe, including serial (com), 1394, and serial-over-named pipe (virtual machine) targets.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the debugging mechanisms I have gone through so far will also support kernel debugging, though I have not focused on this fact.\u00c2\u00a0 You can use remote.exe\u00c2\u00a0for controlling KD remotely, and -server\/-remote\u00c2\u00a0for controlling one KD through another KD or WinDbg.\u00c2\u00a0 Both of these mechanisms can be used to control a kernel debugger remotely (keep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/37"}],"collection":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":1,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":663,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/663"}],"wp:attachment":[{"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nynaeve.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}