target/xtensa: fill register number field in the cache

Currently 'number' field is zero in the register cache and
this causes an issue on `rtos get_thread_reg_list` calls.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iaef11e01f55d012969bbc1933f82847d5e02fec5
Reviewed-on: https://review.openocd.org/c/openocd/+/7246
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Erhan Kurubas 2022-10-04 22:54:58 +02:00 committed by Antonio Borneo
parent 2d5d8a5a62
commit 3b8333bd3f
1 changed files with 6 additions and 0 deletions

View File

@ -2503,6 +2503,12 @@ static int xtensa_build_reg_cache(struct target *target)
unsigned int j;
for (j = 0; j < reg_cache->num_regs; j++) {
if (!strcmp(reg_cache->reg_list[j].name, xtensa->contiguous_regs_desc[i]->name)) {
/* Register number field is not filled above.
Here we are assigning the corresponding index from the contiguous reg list.
These indexes are in the same order with gdb g-packet request/response.
Some more changes may be required for sparse reg lists.
*/
reg_cache->reg_list[j].number = i;
xtensa->contiguous_regs_list[i] = &(reg_cache->reg_list[j]);
LOG_TARGET_DEBUG(target,
"POPULATE contiguous regs list: %-16s, dbreg_num 0x%04x",