gdb_server: do not start multiple instances on "pipe"

For configurations which include multiple targets and the "pipe" mode is
requested only the first gdb_server instance should be enabled,
otherwise GDB gets confusing replies, goes out of sync and the session
fails in weird ways.

Compile-tested only.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: If8f13aa7b58e9b0dc6d5ae88cf75538b34cc1218
Reviewed-on: https://review.openocd.org/c/openocd/+/8222
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Paul Fertser 2024-04-25 14:33:07 +03:00 committed by Antonio Borneo
parent 1fba55a9b6
commit ed9203f4aa
1 changed files with 3 additions and 1 deletions

View File

@ -3879,7 +3879,7 @@ static int gdb_target_add_one(struct target *target)
return gdb_target_start(target, target->gdb_port_override);
}
if (strcmp(gdb_port, "disabled") == 0) {
if (strcmp(gdb_port_next, "disabled") == 0) {
LOG_INFO("gdb port disabled");
return ERROR_OK;
}
@ -3908,6 +3908,8 @@ static int gdb_target_add_one(struct target *target)
gdb_port_next = strdup("0");
}
}
} else if (strcmp(gdb_port_next, "pipe") == 0) {
gdb_port_next = "disabled";
}
}
return retval;