diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-12-16 01:59:14 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2022-02-14 15:10:10 +0000 |
commit | 16cc853bcfbcc8dba6eadd91b434c05387034c0a (patch) | |
tree | cee31fec1a5bb238ab7d1e9b0170edbfdfc2ffa2 /src/server | |
parent | 5ab74bde06541ce199390ead348a3e107ee9c0f4 (diff) | |
download | riscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.zip riscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.tar.gz riscv-openocd-16cc853bcfbcc8dba6eadd91b434c05387034c0a.tar.bz2 |
target/smp: use a struct list_head to hold the smp targets
Instead of reinventing a simply linked list, reuse the list helper
for the list of targets in a smp cluster.
Using the existing helper, that implements a double linked list,
makes trivial going through the list in reverse order.
Change-Id: Ib36ad2955f15cd2a601b0b9e36ca6d948b12d00f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6783
Tested-by: jenkins
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/gdb_server.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index b6f4a82..537670c 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2280,7 +2280,7 @@ static int smp_reg_list_noread(struct target *target, *combined_list_size = 0; struct target_list *head; - foreach_smp_target(head, target->head) { + foreach_smp_target(head, target->smp_targets) { struct reg **reg_list = NULL; int reg_list_size; int result = target_get_gdb_reg_list_noread(head->target, ®_list, @@ -2330,7 +2330,7 @@ static int smp_reg_list_noread(struct target *target, } /* Now warn the user about any registers that weren't found in every target. */ - foreach_smp_target(head, target->head) { + foreach_smp_target(head, target->smp_targets) { struct reg **reg_list = NULL; int reg_list_size; int result = target_get_gdb_reg_list_noread(head->target, ®_list, @@ -3659,13 +3659,10 @@ static int gdb_target_start(struct target *target, const char *port) /* initialize all targets gdb service with the same pointer */ { struct target_list *head; - struct target *curr; - head = target->head; - while (head) { - curr = head->target; + foreach_smp_target(head, target->smp_targets) { + struct target *curr = head->target; if (curr != target) curr->gdb_service = gdb_service; - head = head->next; } } return ret; |