A short example showing in context of wanting to debug an application running on a remote machine where you may not have the source code readily available, or access rights to install on the machine. In this case you can copy over gdbserver to the remote and target it with gdb.
https://sourceware.org/gdb/
https://sourceware.org/gdb/current/on...