server/gdb_server: Add support for default thread, use by IDA debugger

Signed-off-by: Benoit Forgette <benoit.forgette@ci-yow.com>
Change-Id: Ia3a29a3377be650f0ccad11a0ae4fe4da78b3ab4
Reviewed-on: https://review.openocd.org/c/openocd/+/7017
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
MadSquirrel 2022-06-04 22:01:11 +02:00 committed by Antonio Borneo
parent c271958850
commit 5f46de2e79
1 changed files with 92 additions and 93 deletions

View File

@ -3030,20 +3030,23 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
gdb_running_type = 's'; gdb_running_type = 's';
bool fake_step = false; bool fake_step = false;
if (strncmp(parse, "s:", 2) == 0) {
struct target *ct = target; struct target *ct = target;
int current_pc = 1; int current_pc = 1;
int64_t thread_id; int64_t thread_id;
parse++;
packet_size--;
if (parse[0] == ':') {
char *endp; char *endp;
parse++;
parse += 2; packet_size--;
packet_size -= 2;
thread_id = strtoll(parse, &endp, 16); thread_id = strtoll(parse, &endp, 16);
if (endp) { if (endp) {
packet_size -= endp - parse; packet_size -= endp - parse;
parse = endp; parse = endp;
} }
} else {
thread_id = 0;
}
if (target->rtos) { if (target->rtos) {
/* FIXME: why is this necessary? rtos state should be up-to-date here already! */ /* FIXME: why is this necessary? rtos state should be up-to-date here already! */
@ -3071,7 +3074,7 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
int64_t tid; int64_t tid;
parse += 1; parse += 1;
tid = strtoll(parse, &endp, 16); tid = strtoll(parse, NULL, 16);
if (tid == thread_id) { if (tid == thread_id) {
/* /*
* Special case: only step a single thread (core), * Special case: only step a single thread (core),
@ -3145,13 +3148,9 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
gdb_connection->output_flag = GDB_OUTPUT_NO; gdb_connection->output_flag = GDB_OUTPUT_NO;
} else } else
gdb_connection->frontend_state = TARGET_RUNNING; gdb_connection->frontend_state = TARGET_RUNNING;
} else {
LOG_ERROR("Unknown vCont packet");
return false;
}
return true; return true;
} }
LOG_ERROR("Unknown vCont packet");
return false; return false;
} }