In my career, I've seen that most of us use Visual Studio for debugging, not many other free debuggers. You may have many reasons to use such a debugger, such as not having a development environment installed on your home machine, but a program crashes over and over. In fact, according to the stack dump can determine whether IE crash is due to a third-party plug-in.
For WinDbg, I haven't found a good QuickStart tutorial so far. This article discusses the use of WinDbg in combination with examples. Let me first assume that you are familiar with the basic concepts of debugging: Stepping in, stepping out, breakpoints, and remote debugging.
Note that this would have been an introductory document for seating, which you can read and start using WinDbg. If you have questions about a particular command, consult the WinDbg documentation. You can use the commands mentioned in this article in any debugger provided by Microsoft, for example, in the VS command line window.
This article is based on WinDbg 6.3.
This is just the first of a series of articles on debugging technology. In the next article, I'll explain how to write an extension DLL for the debugger. Debugger Overview
Here's a description of the debugger you can download from the Microsoft website:
· Kd-the kernel debugger. You can use it to debug a blue screen type of system problem. If you are developing a device driver, it is unavoidable.
· cdb-Command Line Debugger. This is a command-line program.
· Ntsd-nt the debugger. This is a user-mode debugger that you can use to debug user-mode applications. It is actually a CDB Windows UI enhancement.
· windbg-the KD and ntsd with a nice UI. WinDbg can debug kernel mode or debug user-mode programs.
· VS, vs.net-uses the same debugging engine as KD and NTSD, and provides a richer interface than the same windbg for debugging purposes. comparisons between debuggers
WinDbg actually packs NTSD and KD and provides a better user interface. It also provides command-line switches, such as minimizing startup (-m), attaching to a PID-specified process (-p), and automatically opening a crash file (-Z). It supports three different types of commands.
· Regular commands (for example: K) is used to debug a process
· The Dot commands (for example:. Sympath) is used to control the debugger
· Extension commands (for example:!handle)-These commands are custom commands that can be used to add to WinDbg, and they are implemented using an extension DLL's output function. PDB Files
The PDB file refers to the linker Generator database file (program databases files). Private PDB files include private and public symbols, source code line numbers, types, local, and global variables. The public PDB file does not contain types, local variables, and source code line number information.
Debugging Scenarios Remote Debugging
It is easy to use WinDbg for remote debugging, and there are a number of possible ways. In the following, the ' debug server ' refers to the debugger running on the remote machine you want to debug. ' Debug client ' refers to the debugger that controls the current session.
· Using the debugger: You need CDB, NTSD, or WinDbg already installed on the remote machine. The WinDbg client can connect to either CDB, NTSD, or WinDbg as a server, and vice versa. TCP or Named pipes can be selected directly from the client and the server as a communication protocol.
o The server-side boot process:
§windbg–server Npipe:pipe=pipename (Note: Multiple clients can be allowed to connect or
§ from WinDbg internal:. Server Npipe:pipe=pipename (note, connecting a single client)
You can use a variety of protocols to open different service sessions. And a password is available to protect a session.
O Connect from client:
§windbg-remote Npipe:server=server, Pipe=pipename[,password=password]
§ From WinDbg Interior: File->connect to Remote session:for connection string, enter Npipe:server=server, Pipe=pipename [, Passwor D=password]
· Use Named pipes as a way to communicate using Remote.exe:Remote.exe. If you are using a command-line interface program, such as KD,CDB or NTSD. You can use Remote.exe to debug remotely. Note: Use @q (not Q) to exit the client without turning off the server.
o to start a service side:
§remote.exe/s "Cdp–p <pid>" test1
O Connect from client:
§REMOTE.EXE/C <machinename> Test1
The test1 above is the name of the named pipe we chose.