# External programs and GDB Debugger

The "Run a program before debugging" option in [Remote GDB Debugger options](https://docs.hex-rays.com/user-guide/debugger/remote-debugging/remote-gdb-debugger/remote-gdb-debugger-options) allows to automatically run a program (such as a debugging server) when starting a debugging session. If you enable it, the following options become available:

Command line

```
        Command line of the program to run. The following special symbols can be used:
```

%i: input file name from the [Process options](https://docs.hex-rays.com/user-interface/menu-bar/common-actions-3#process-options) dialog %p: port number from the [Process options](https://docs.hex-rays.com/user-interface/menu-bar/common-actions-3#process-options) dialog %e: file name of a temporary ELF file created from the database contents Initial SP

```
        IDA will set the SP (or a similar register) after connecting to the server
```

Choose a configuration

```
        Load one of the pre-defined configurations (command line, memory map and SP value)
        described in the gdb_arch.cfg file.
```

Memory map

```
        Edit the memory map for the external server. It will be used during debugging.
```

One use of these options is to [debug small code snippets](https://docs.hex-rays.com/user-guide/debugger/remote-debugging/remote-gdb-debugger/debugging-code-snippets-with-qemu) using the QEMU emulator.

See also

* [Remote GDB Debugger options](https://docs.hex-rays.com/user-guide/debugger/remote-debugging/remote-gdb-debugger/remote-gdb-debugger-options)
* [Debugger submenu](https://docs.hex-rays.com/user-guide/user-interface/menu-bar/common-actions-3).
