target: use list for target events

To simplify removing an event when it's set to an empty string,
switch event list from hardcoded simply linked list to helper's
double linked list.

While there, move the declaration of struct target_event_action
in 'target.c' as it is not anymore visible outside.

Change-Id: I799754c80055dc6d22db55aca483757e833714ff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8813
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2025-03-23 12:09:28 +01:00
parent 04124c77f4
commit c023534e7b
2 changed files with 26 additions and 24 deletions

View File

@@ -139,7 +139,7 @@ struct target {
*/
bool running_alg;
struct target_event_action *event_action;
struct list_head events_action;
bool reset_halt; /* attempt resetting the CPU into the halted mode? */
target_addr_t working_area; /* working area (initialised RAM). Evaluated
@@ -295,13 +295,6 @@ enum target_event {
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X107 = 0x107,
};
struct target_event_action {
enum target_event event;
Jim_Interp *interp;
Jim_Obj *body;
struct target_event_action *next;
};
bool target_has_event_action(const struct target *target, enum target_event event);
struct target_event_callback {