29 Debugger Adapter Protocol

Generally, GDB implements the Debugger Adapter Protocol as written. However, in some cases, extensions are either needed or even expected.

GDB defines some parameters that can be passed to the launch request:

args

If provided, this should be an array of strings. These strings are provided as command-line arguments to the inferior, as if by set args. See Your Program’s Arguments.

cwd

If provided, this should be a string. GDB will change its working directory to this directory, as if by the cd command (see Your Program’s Working Directory). The launched program will inherit this as its working directory. Note that change of directory happens before the program parameter is processed. This will affect the result if program is a relative filename.

env

If provided, this should be an object. Each key of the object will be used as the name of an environment variable; each value must be a string and will be the value of that variable. The environment of the inferior will be set to exactly as passed in. See Your Program’s Environment.

program

If provided, this is a string that specifies the program to use. This corresponds to the file command. See Commands to Specify Files.

stopAtBeginningOfMainSubprogram

If provided, this must be a boolean. When ‘True’, GDB will set a temporary breakpoint at the program’s main procedure, using the same approach as the start command. See Starting your Program.

GDB defines some parameters that can be passed to the attach request. One of these must be specified.

pid

The process ID to which GDB should attach. See Debugging an Already-running Process.

target

The target to which GDB should connect. This is a string and is passed to the target remote command. See Connecting to a Remote Target.

In response to the disassemble request, DAP allows the client to return the bytes of each instruction in an implementation-defined format. GDB implements this by sending a string with the bytes encoded in hex, like "55a2b900".