26.15. gdb/mi Target Manipulation Commands

26.15.1. The -target-attachCommand

26.15.1.1. Synopsis

 -target-attach pid | file

Attach to a process pid or a file file outside of gdb.

26.15.1.2. gdb command

The corresponding gdb command is attach.

26.15.1.3. Example

N.A.

26.15.2. The -target-compare-sectionsCommand

26.15.2.1. Synopsis

 -target-compare-sections [ section ]

Compare data of section section on target to the exec file. Without the argument, all sections are compared.

26.15.2.2. gdb Command

The gdb equivalent is compare-sections.

26.15.2.3. Example

N.A.

26.15.3. The -target-detachCommand

26.15.3.1. Synopsis

 -target-detach

Disconnect from the remote target. There's no output.

26.15.3.2. gdb command

The corresponding gdb command is detach.

26.15.3.3. Example

(gdb)
-target-detach
^done
(gdb)

26.15.4. The -target-disconnectCommand

26.15.4.1. Synopsis

 -target-disconnect

Disconnect from the remote target. There's no output.

26.15.4.2. gdb command

The corresponding gdb command is disconnect.

26.15.4.3. Example

(gdb)
-target-disconnect
^done
(gdb)

26.15.5. The -target-downloadCommand

26.15.5.1. Synopsis

 -target-download

Loads the executable onto the remote target. It prints out an update message every half second, which includes the fields:

section

The name of the section.

section-sent

The size of what has been sent so far for that section.

section-size

The size of the section.

total-sent

The total size of what was sent so far (the current and the previous sections).

total-size

The size of the overall executable to download.

Each message is sent as status record (refer to Section 26.4.2 gdb/mi Output Syntax).

In addition, it prints the name and size of the sections, as they are downloaded. These messages include the following fields:

section

The name of the section.

section-size

The size of the section.

total-size

The size of the overall executable to download.

At the end, a summary is printed.

26.15.5.2. gdb Command

The corresponding gdb command is load.

26.15.5.3. Example

Note: each status message appears on a single line. Here the messages have been broken down so that they can fit onto a page.

(gdb)
-target-download
+download,{section=".text",section-size="6668",total-size="9880"}
+download,{section=".text",section-sent="512",section-size="6668",
total-sent="512",total-size="9880"}
+download,{section=".text",section-sent="1024",section-size="6668",
total-sent="1024",total-size="9880"}
+download,{section=".text",section-sent="1536",section-size="6668",
total-sent="1536",total-size="9880"}
+download,{section=".text",section-sent="2048",section-size="6668",
total-sent="2048",total-size="9880"}
+download,{section=".text",section-sent="2560",section-size="6668",
total-sent="2560",total-size="9880"}
+download,{section=".text",section-sent="3072",section-size="6668",
total-sent="3072",total-size="9880"}
+download,{section=".text",section-sent="3584",section-size="6668",
total-sent="3584",total-size="9880"}
+download,{section=".text",section-sent="4096",section-size="6668",
total-sent="4096",total-size="9880"}
+download,{section=".text",section-sent="4608",section-size="6668",
total-sent="4608",total-size="9880"}
+download,{section=".text",section-sent="5120",section-size="6668",
total-sent="5120",total-size="9880"}
+download,{section=".text",section-sent="5632",section-size="6668",
total-sent="5632",total-size="9880"}
+download,{section=".text",section-sent="6144",section-size="6668",
total-sent="6144",total-size="9880"}
+download,{section=".text",section-sent="6656",section-size="6668",
total-sent="6656",total-size="9880"}
+download,{section=".init",section-size="28",total-size="9880"}
+download,{section=".fini",section-size="28",total-size="9880"}
+download,{section=".data",section-size="3156",total-size="9880"}
+download,{section=".data",section-sent="512",section-size="3156",
total-sent="7236",total-size="9880"}
+download,{section=".data",section-sent="1024",section-size="3156",
total-sent="7748",total-size="9880"}
+download,{section=".data",section-sent="1536",section-size="3156",
total-sent="8260",total-size="9880"}
+download,{section=".data",section-sent="2048",section-size="3156",
total-sent="8772",total-size="9880"}
+download,{section=".data",section-sent="2560",section-size="3156",
total-sent="9284",total-size="9880"}
+download,{section=".data",section-sent="3072",section-size="3156",
total-sent="9796",total-size="9880"}
^done,address="0x10004",load-size="9880",transfer-rate="6586",
write-rate="429"
(gdb)

26.15.6. The -target-exec-statusCommand

26.15.6.1. Synopsis

 -target-exec-status

Provide information on the state of the target (whether it is running or not, for instance).

26.15.6.2. gdb Command

There's no equivalent gdb command.

26.15.6.3. Example

N.A.

26.15.7. The -target-list-available-targetsCommand

26.15.7.1. Synopsis

 -target-list-available-targets

List the possible targets to connect to.

26.15.7.2. gdb Command

The corresponding gdb command is help target.

26.15.7.3. Example

N.A.

26.15.8. The -target-list-current-targetsCommand

26.15.8.1. Synopsis

 -target-list-current-targets

Describe the current target.

26.15.8.2. gdb Command

The corresponding information is printed by info file (among other things).

26.15.8.3. Example

N.A.

26.15.9. The -target-list-parametersCommand

26.15.9.1. Synopsis

 -target-list-parameters

26.15.9.2. gdb Command

No equivalent.

26.15.9.3. Example

N.A.

26.15.10. The -target-selectCommand

26.15.10.1. Synopsis

 -target-select type parameters …

Connect gdb to the remote target. This command takes two args:

type

The type of target, for instance async, remote, etc.

parameters

Device names, host names and the like. Refer to Section 18.2 Commands for managing targets, for more details.

The output is a connection notification, followed by the address at which the target program is, in the following form:

^connected,addr="address",func="function name",
  args=[arg list]

26.15.10.2. gdb Command

The corresponding gdb command is target.

26.15.10.3. Example

(gdb)
-target-select async /dev/ttya
^connected,addr="0xfe00a300",func="??",args=[]
(gdb)