diff --git a/nemu/src/monitor/sdb/watchpoint.c b/nemu/src/monitor/sdb/watchpoint.c index 7b3dee0..e8cec07 100644 --- a/nemu/src/monitor/sdb/watchpoint.c +++ b/nemu/src/monitor/sdb/watchpoint.c @@ -61,11 +61,11 @@ bool wp_check_hit(void) { return res; } -static WP* del_wp(WP* head, WP* pos) { - for (WP** i = &head; (*i) != NULL && (*i)->next != NULL; i = (WP**)*i) { +static WP* del_wp(WP** head, WP* pos) { + for (WP** i = head; (*i) != NULL && (*i)->next != NULL; i = (WP**)*i) { if ((**i).NO == pos->NO) { WP* res = *i; - *i = (**i).next; + *i = (*i)->next; return res; } } @@ -87,7 +87,7 @@ WP* new_wp(char* _expr, int len) { if (!success) { return NULL; } - WP* wp = del_wp(free_, free_); + WP* wp = del_wp(&free_, free_); if (wp == NULL) { assert(0); } @@ -108,7 +108,7 @@ WP* get_wp(int NO) { } void free_wp(WP *_wp) { - WP* wp = del_wp(head, _wp); + WP* wp = del_wp(&head, _wp); wp->next = free_; free_ = wp; wp->expr[0] = '\0';