To attach to an existing process on a local or remote machine, use the Attach to process command available in WinGDB menu. The following dialog will appear:
The Host, Target and Build login fields supply the login information. It usually consists of your user account name and the target host name or IP address. Optionally you can provide also a port number and/or a password. The syntax is "username[:password]@hostname[:port]" where square brackets denote optional parts. If you don't specify the port, it will default to 22. If you don't provide the password, another dialog will appear, prompting you for it. You can find more information about supported authentication methods in this section.
Usually the Host Login field is required, as it concerns the machine where the debugger is being run. If the debugger is being run on the local machine, this field will be grayed out. The Target login concerns the machine where the debugged process is being run, if different than the Debug Host machine. It is used in Embedded Linux and Indirect modes, where gdbserver is used. The Build login can be used to supply login to the build machine, if Load sources from build host option is active. Typically you can leave it blank.
In Indirect and Embedded Linux modes, the executable exists in two copies: one on the target machine (where it is being run) and another one on the debug host machine where the debugger is being run. The debugger needs this copy of the executable to access debug info. In case of attaching, the debugger automatically determines where the executable is on target, examining the running process. But it cannot find the copy on debug host this way. Hence you have to specify this path manually in the Executable path field. In remaining modes this field is not needed and grayed out.
Choose a process select a process from the list. To refresh list of processes available on specified host use button 'Refresh'. To attach to specified process immediately use mouse double-click.
Show processes from all users check box allows you to choose whether the process list contains processes from all users, or only for the user which name you specified in the login string.
Also you can set other settings, accessible after clicking the Advanced settings button. These options are described in more detail in this section.
To attach to an existing process on a remote machine, you can also use the "Attach to process" command available in menu "Tools". The standard "Attach to process" dialog should appear. In the dialog choose the "WinGDB" transport and provide login information in the "Qualifier" field. The format is "username[:password]@hostname[:port]", where square brackets denote optional parts.
The password and the port number are optional. If you don't specify the port, it will default to 22. You may also omit the password, but in that case another dialog will appear, prompting you for the password:
The "Show processes from all users" check box allows you to choose whether the process list contains processes from all users, or only for the user which name you specified in the login string.
This option is available only in some editions of Visual Studio. If "WinGDB" transport doesn't show up on your edition, please use the "Attach to process" command from WinGDB menu instead.