# Debugging with gdbserver

gdbserver is a GDB stub implemented as a separate program. It runs a program to be debugged or attaches to a process and then waits for commands. The remote GDB debugger module has been tested with gdbserver available with Cygwin and Linux.

To debug a specific program from the start, run the following command:

```
    gdbserver localhost:23946 <program>
```

and then choose Debugger,Attach,\<process running on target> in IDA.

To debug a running process:

```
    gdbserver --multi localhost:23947
```

then choose Debugger,Attach,\<enter PID to attach> in IDA and enter the PID of the process to attach to.

Another method of debugging a running process is:

```
    gdbserver localhost:23947 --attach <PID>
```

then choose Debugger,Attach,\<process running on target> in IDA.

To start a program from inside IDA, first launch the debugger server:

```
    gdbserver --multi localhost:23947
```

Then use Debugger,Start process or Debugger,Run in IDA.

```
 NOTE
```

The --multi option is only available in GDB 6.8 or higher.

Back to [Remote GDB Debugger](https://docs.hex-rays.com/user-guide/debugger/remote-debugging/remote-gdb-debugger)
