Windbg skills: How to Use windbg to remotely debug programs

Source: Internet
Author: User

In some cases, remote debugging is required (for example, full screen is required when the program runs, or the program crashes on the client's machine). In this case, the remote debugging function of windbg can be used.

 

Remote debugging of windbg consists of the server and client, which is similar to Visual Studio. The machine to be debugged is the server, and the machine to be debugged is the client ). Windbg must be installed on both machines.

 

Step 1: Create a windbg server.

 

Use the-server parameter to enable windbg to start as a server. Windbg can connect clients using multiple connection protocols, such as named pipe, secure pipe, TCP, and SSL, serial Port/parallel port (COM port) and so on.

 

Named Pipe

Windbg.exe -Server npipe: Pipe=Pipename[,Hidden] [,Password=Password] [,Icfenable] [-NOIO] [Options] 

 

TCP protocol

Windbg.exe-Server TCP: Port=Socket[,Hidden] [,Password=Password] [,Ipversion=6] [,Icfenable] [-NOIO] [Options]
Windbg.exe-Server TCP: Port=Socket,Clicon=Client[,Password=Password] [,Ipversion=6] [-NOIO] [Options] 

 

Serial/parallel port
Windbg.exe-Server COM: Port=Comport,Baud=Baudrate,Channel=Comchannel[,Hidden],Password=Password] [-NOIO] [Options] 

 

Security Pipeline

Windbg.exe-Server spipe: PROTO=Protocol,Certuser=CERT| Machuser=CERT},Pipe=Pipename[,Hidden],Password=Password] [-NOIO] [Options] 

 

SSL protocol

Windbg.exe-Server SSL: PROTO=Protocol,Certuser=CERT| Machuser=CERT},Port=Socket[,Hidden],Password=Password] [-NOIO] [Options]
Windbg.exe-Server SSL: PROTO=Protocol,Certuser=CERT| Machuser=CERT},Port=Socket,Clicon=Client[,Password=Password] [-NOIO] [Options]

 

 

Example:

Windbg.exe-Server npipe: pipe = dbgpipe winmine.exe (Use the named pipe dbgpipe to create the ghost service and use the winmine.exe Program)

 

Windbg.exe-Server TCP: Port = 1025-P 122 (using the TCP protocol, establish a debugging service on port 1025, debug the program with process number 122 on the machine, or debug the process from attach to 122)

 

 

Step 2: Use the windbg client to connect to the server

 

You can use the-Remote Parameter to enable windbg to connect to the server as a client. You can specify different connection methods:

 

Named Pipe

Windbg.exe-remote npipe: Server = server, pipe = pipename [, password = PASSWORD]

 

TCP protocol

Windbg.exe-remote TCP: Server = server, Port = socket [, password = PASSWORD] [, ipversion = 6]
Windbg.exe-remote TCP: clicon = server, Port = socket [, password = PASSWORD] [, ipversion = 6]

 

Serial/parallel port

Windbg.exe-Remote COM: Port = comport, baud = baudrate, channel = comchannel [, password = PASSWORD]

 

Security Pipeline

Windbg.exe-remote spipe: PROTO = protocol, {certuser = Cert | machuser = Cert}, Server = server, pipe = pipename [, password = PASSWORD]

 

SSL protocol

Windbg.exe-remote SSL: PROTO = protocol, {certuser = Cert | machuser = Cert}, Server = server, Port = socket [, password = PASSWORD]
Windbg.exe-remote SSL: PROTO = protocol, {certuser = Cert | machuser = Cert}, clicon = server, Port = socket [, password = PASSWORD]

 

 

Example (assume that the name of the machine to be debugged isDbgpc):


Windbg.exe-Remote npipe: Server = dbgpc, pipe = dbgpipe (Use the named pipe dbgpipe to establish a connection to the debugged machine dbgpc)


Windbg.exe-Remote TCP: Server = dbgpc, Port = 1025 (using the TC protocol, connect to the port 1025 of The debugged machine dbgpc)

 

 

For more details about Windows Remote debugging, see the msdn http://msdn.microsoft.com/en-us/library/cc266457.aspx

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.