Skip to content

Commit 3fd1d27

Browse files
committed
target/xtensa: merge from upstream part3
1 parent 5bac6ea commit 3fd1d27

23 files changed

+2091
-2421
lines changed

src/rtos/FreeRTOS.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,7 @@ static int freertos_get_tasks_details(struct target *target,
777777
return ERROR_FAIL;
778778
}
779779
rtos->thread_details[index].exists = true;
780-
const struct freertos_tls_info *tls_info =
781-
rtos_freertos_get_tls_info(target);
780+
const struct freertos_tls_info *tls_info = rtos_freertos_get_tls_info(target);
782781
if (tls_info &&
783782
!rtos->thread_details[index].tls_addr) {
784783
struct rtos_reg reg;
@@ -1114,8 +1113,12 @@ static int freertos_get_current_thread_registers(struct rtos *rtos, int64_t thre
11141113
return ERROR_FAIL;
11151114
}
11161115

1116+
bool is_xtensa = strncmp(target_get_gdb_arch(current_target), "xtensa", 6) == 0;
11171117
for (int i = 0; i < *num_regs; i++) {
1118-
(*reg_list)[i].number = gdb_reg_list[i]->number;
1118+
if (is_xtensa)
1119+
(*reg_list)[i].number = i;
1120+
else
1121+
(*reg_list)[i].number = gdb_reg_list[i]->number;
11191122
(*reg_list)[i].size = gdb_reg_list[i]->size;
11201123
memcpy((*reg_list)[i].value, gdb_reg_list[i]->value,
11211124
((*reg_list)[i].size + 7) / 8);

src/rtos/nuttx.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,14 @@ static int nuttx_getreg_current_thread(struct rtos *rtos,
389389
return ERROR_FAIL;
390390
}
391391

392+
bool is_xtensa = strncmp(target_get_gdb_arch(rtos->target), "xtensa", 6) == 0;
392393
for (int i = 0; i < *num_regs; i++) {
393-
(*reg_list)[i].number = gdb_reg_list[i]->number;
394+
if (is_xtensa)
395+
(*reg_list)[i].number = i;
396+
else
397+
(*reg_list)[i].number = gdb_reg_list[i]->number;
394398
(*reg_list)[i].size = gdb_reg_list[i]->size;
395-
memcpy((*reg_list)[i].value, gdb_reg_list[i]->value,
396-
((*reg_list)[i].size + 7) / 8);
399+
memcpy((*reg_list)[i].value, gdb_reg_list[i]->value, ((*reg_list)[i].size + 7) / 8);
397400
}
398401

399402
free(gdb_reg_list);

0 commit comments

Comments
 (0)