GDBSERVER(1)
๐ gdbserver(1) โ GNU Development Tools ๐
okay bestie, this is the manual page for gdbserver, and it's literally the remote server for the GNU Debugger. It's giving โdebug from another machineโ main character energy, so let's get into it. ๐
โจ NAME โจ
gdbserver โ Remote Server for the GNU Debugger ๐ซถ
๐ SYNOPSIS ๐
gdbserver comm prog [args...]
gdbserver --attach comm pid
gdbserver --multi comm
๐ DESCRIPTION ๐
gdbserver is a program that lets you run ROCGDB on a different machine than the one running the program you're debugging. Yes, bestie โ remote debugging. Iconic. โจ
๐ฅ๏ธ Usage (server (target) side) ๐ฅ๏ธ
First, you need to have a copy of the program you want to debug put onto the target system. The program can be stripped to save space if needed, because gdbserver doesn't care about symbols. All symbol handling is taken care of by the ROCGDB running on the host system. ๐
To use the server, you log on to the target system and run the gdbserver program. You must tell it:
- how to communicate with ROCGDB
- the name of your program
- its arguments
The general syntax is:
target> gdbserver <comm> <program> [<args> ...]
For example, using a serial port, you might say:
target> gdbserver /dev/com1 emacs foo.txt
This tells gdbserver to debug emacs with an argument of foo.txt, and to communicate with ROCGDB via /dev/com1. Then gdbserver waits patiently for the host ROCGDB to communicate with it. Patient queen behavior. ๐
To use a TCP connection, you could say:
target> gdbserver host:2345 emacs foo.txt
This says pretty much the same thing as the last example, except that we're going to communicate with the "host" ROCGDB via TCP. The "host:2345" argument means we're expecting to see a TCP connection from "host" to local TCP port 2345. (Currently, the "host" part is ignored.) You can choose any number you want for the port number as long as it doesn't conflict with any existing TCP ports on the target system. This same port number must be used in the host ROCGDB's "target remote" command, which will be described shortly. Note that if you chose a port number that conflicts with another service, gdbserver will print an error message and exit. ๐ซ
gdbserver can also attach to running programs. This is accomplished via the --attach argument. The syntax is:
target> gdbserver --attach <comm> <pid>
pid is the process ID of a currently running process. It isn't necessary to point gdbserver at a binary for the running process. Lowkey convenient. ๐ฆ
To start "gdbserver" without supplying an initial command to run or process ID to attach, use the --multi command line option. In such case you should connect using "target extended-remote" to start the program you want to debug.
target> gdbserver --multi <comm>
๐ป Usage (host side) ๐ป
You need an unstripped copy of the target program on your host system, since ROCGDB needs to examine its symbol tables and such. Start up ROCGDB as you normally would, with the target program as the first argument. (You may need to use the --baud option if the serial line is running at anything except 9600 baud.) That is gdb TARGET-PROG, or gdb --baud BAUD TARGET-PROG. After that, the only new command you need to know about is "target remote" (or "target extended-remote"). Its argument is either a device name (usually a serial device, like /dev/ttyb), or a "HOST:PORT" descriptor. For example:
(gdb) target remote /dev/ttyb
communicates with the server via serial line /dev/ttyb, and:
(gdb) target remote the-target:2345
communicates via a TCP connection to port 2345 on host `the-target', where you previously started up gdbserver with the same port number. Note that for TCP connections, you must start up gdbserver prior to using the `target remote' command, otherwise you may get an error that looks something like `Connection refused'. ๐ญ
gdbserver can also debug multiple inferiors at once, described in the ROCGDB manual in node "Inferiors Connections and Programs" โ shell command "info -f gdb -n 'Inferiors Connections and Programs'". In such case use the "extended-remote" ROCGDB command variant:
(gdb) target extended-remote the-target:2345
The gdbserver option --multi may or may not be used in such case. No cap. ๐
๐๏ธ OPTIONS ๐๏ธ
There are three different modes for invoking gdbserver:
- Debug a specific program specified by its program name:
gdbserver <comm> <prog> [<args>...]
The comm parameter specifies how the server should communicate with ROCGDB; it is either a device name (to use a serial line), a TCP port number (":1234"), or "-" or "stdio" to use stdin/stdout of "gdbserver". Specify the name of the program to debug in prog. Any remaining arguments will be passed to the program verbatim. When the program exits, ROCGDB will close the connection, and "gdbserver" will exit. ๐
- Debug a specific program by specifying the process ID of a running program:
gdbserver --attach <comm> <pid>
The comm parameter is as described above. Supply the process ID of a running program in pid; ROCGDB will do everything else. Like with the previous mode, when the process pid exits, ROCGDB will close the connection, and "gdbserver" will exit. โจ
- Multi-process mode โ debug more than one program/process:
gdbserver --multi <comm>
In this mode, ROCGDB can instruct gdbserver which command(s) to run. Unlike the other 2 modes, ROCGDB will not close the connection when a process being debugged exits, so you can debug several processes in the same session. Main character multi-tasking energy. ๐
In each of the modes you may specify these options:
--helpโ List all options, with brief explanations. ๐ซถ--versionโ This option causesgdbserverto print its version number and exit. ๐--attachโgdbserverwill attach to a running program. The syntax is:
target> gdbserver --attach <comm> <pid>
pid is the process ID of a currently running process. It isn't necessary to point gdbserver at a binary for the running process. ๐ฆ
--multiโ To start"gdbserver"without supplying an initial command to run or process ID to attach, use this command line option. Then you can connect using"target extended-remote"and start the program you want to debug. The syntax is:
target> gdbserver --multi <comm>
--debug[=option1,option2,...]โ Instruct"gdbserver"to display extra status information about the debugging process. This option is intended for"gdbserver"development and for bug reports to the developers. ๐ง
Each option is the name of a component for which debugging should be enabled. The list of possible options is all, threads, event-loop, remote. The special option all enables all components. The option list is processed left to right, and an option can be prefixed with the - character to disable output for that component, so you could write:
target> gdbserver --debug=all,-event-loop
to turn on debug output for all components except event-loop. If no options are passed to --debug then this is treated as equivalent to --debug=threads. This could change in future releases of "gdbserver". ๐
--debug-file=filenameโ Instruct"gdbserver"to send any debug output to the givenfilename. This option is intended for"gdbserver"development and for bug reports to the developers. ๐--debug-format=option1[,option2,...]โ Instruct"gdbserver"to include extra information in each line of debugging output. ๐ธ--wrapperโ Specify a wrapper to launch programs for debugging. The option should be followed by the name of the wrapper, then any command-line arguments to pass to the wrapper, then--indicating the end of the wrapper arguments. ๐--onceโ By default,gdbserverkeeps the listening TCP port open, so that additional connections are possible. However, if you start"gdbserver"with the--onceoption, it will stop listening for any further connection attempts after connecting to the first ROCGDB session. One and done, periodt. ๐
๐ฑ ENVIRONMENT ๐ฑ
This section is empty in the original page, bestie โ no environment variables are listed here. The vibe check is literally a clean slate. ๐ซถ
๐ SEE ALSO ๐
The full documentation for ROCGDB is maintained as a Texinfo manual. If the "info" and "gdb" programs and ROCGDB's Texinfo documentation are properly installed at your site, the command
info gdb
should give you access to the complete manual. โจ
Using GDB: A Guide to the GNU Source-Level Debugger, Richard M. Stallman and Roland H. Pesch, July 1991. ๐
๐ COPYRIGHT ๐
okay so first things first, the legal stuff, and honestly it's giving very important, so pay attention bestie โจ
Copyright ยฉ 1988-2024 Free Software Foundation, Inc.
You are so allowed to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation โ with the Invariant Sections being "Free Software" and "Free Software Needs Free Documentation", with the Front-Cover Texts being "A GNU Manual," and with the Back-Cover Texts as in (a) down below. iykyk ๐
(a) โ the FSF's Back-Cover Text goes, and I quote, exactly like this:
"You are free to copy and modify this GNU Manual. Buying copies from GNU Press supports the FSF in developing GNU and promoting software freedom."
like, literally buying a copy supports free software. that's the whole vibe ๐ซถ
๐ Legal Disclaimer and Copyright Information ๐
so this next bit is the AMD part, no cap. AMD ROCm software is made available by Advanced Micro Devices, Inc. under the open source license identified in the top-level directory for the library in the repository on Github.com โ the fancy way of writing that is:
@url{https://github.com/ROCm/,Github.com}
(portions of AMD ROCm software are licensed under MITx11 and UIL/NCSA, fr fr โ for more info on the license, review the license.txt in the top-level directory for the library on that same Github.com link). and bestie, the additional terms and conditions below apply to your use of AMD ROCm technical documentation ๐
ยฉ2019-2024 Advanced Micro Devices, Inc. All rights reserved.
okay so the info in this document is for informational purposes only and may contain technical inaccuracies, omissions, and typographical errors ๐ญ it is subject to change and may be rendered inaccurate for many reasons, including but not limited to:
- product and roadmap changes
- component and motherboard version changes
- new model and/or product releases
- product differences between differing manufacturers
- software changes
- BIOS flashes
- firmware upgrades
- or the like
and any computer system has risks of security vulnerabilities that cannot be completely prevented or mitigated โ yeah, that's just how it is ๐ AMD assumes no obligation to update or otherwise correct or revise this information. however, AMD reserves the right to revise this information and to make changes from time to time to the content hereof without obligation of AMD to notify any person of such revisions or changes. so like, keep an eye out ๐
THIS INFORMATION IS PROVIDED "AS IS." AMD MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND ASSUMES NO RESPONSIBILITY FOR ANY INACCURACIES, ERRORS, OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION. AMD SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL AMD BE LIABLE TO ANY PERSON FOR ANY RELIANCE, DIRECT, INDIRECT, SPECIAL, OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
like that's the whole disclaimer, in all its dramatic glory, and yes it's loud on purpose ๐ฃ๏ธ๐ฅ
lastly, the trademarks, because we respect IP in this house:
- AMD, the AMD Arrow logo, AMD Instinctโข, Radeonโข, AMD ROCmโข, and combinations thereof are trademarks of Advanced Micro Devices, Inc.
- Linuxยฎ is the registered trademark of Linus Torvalds in the U.S. and other countries.
- PCIeยฎ is a registered trademark of PCI-SIG Corporation.
- Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
and that's the page, bestie ๐ this was gdb-16.3, all dated 2026-05-31 โ iconic, timeless, periodt ๐
โจ go debug something slay-worthy ๐ธ๐ฆ
๐ฆ where this page comes from
- arch rolling: rocm-gdb 7.2.4-1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms