Browse Source

Fix an infinite loop bug that may be seen with "stop whan a>b" or

"stop when a<>b".
pre-master-46
Giles Atkinson 3 years ago
committed by Holger Vogt
parent
commit
502f15522e
  1. 34
      src/frontend/breakp.c

34
src/frontend/breakp.c

@ -63,6 +63,7 @@ com_stop(wordlist *wl)
d->db_also = TMALLOC(struct dbcomm, 1); d->db_also = TMALLOC(struct dbcomm, 1);
d = d->db_also; d = d->db_also;
} }
d->db_also = NULL;
/* Figure out what the first condition is. */ /* Figure out what the first condition is. */
d->db_analysis = NULL; d->db_analysis = NULL;
@ -127,13 +128,24 @@ com_stop(wordlist *wl)
/* Now get the condition */ /* Now get the condition */
if (eq(wl->wl_word, "eq") || eq(wl->wl_word, "=")) if (eq(wl->wl_word, "eq") || eq(wl->wl_word, "="))
d->db_op = DBC_EQU; d->db_op = DBC_EQU;
else if (eq(wl->wl_word, "ne") || eq(wl->wl_word, "<>"))
else if (eq(wl->wl_word, "ne"))
d->db_op = DBC_NEQ; d->db_op = DBC_NEQ;
else if (eq(wl->wl_word, "gt") || eq(wl->wl_word, ">")) else if (eq(wl->wl_word, "gt") || eq(wl->wl_word, ">"))
d->db_op = DBC_GT; d->db_op = DBC_GT;
else if (eq(wl->wl_word, "lt") || eq(wl->wl_word, "<"))
else if (eq(wl->wl_word, "lt"))
d->db_op = DBC_LT; d->db_op = DBC_LT;
else if (eq(wl->wl_word, "ge") || eq(wl->wl_word, ">="))
else if (eq(wl->wl_word, "<")) {
/* "<>" is parsed as two words. */
if (eq(wl->wl_next->wl_word, ">")) {
if (!wl->wl_next->wl_next)
goto bad;
d->db_op = DBC_NEQ;
wl = wl->wl_next;
} else {
d->db_op = DBC_LT;
}
} else if (eq(wl->wl_word, "ge") || eq(wl->wl_word, ">="))
d->db_op = DBC_GTE; d->db_op = DBC_GTE;
else if (eq(wl->wl_word, "le") || eq(wl->wl_word, "<=")) else if (eq(wl->wl_word, "le") || eq(wl->wl_word, "<="))
d->db_op = DBC_LTE; d->db_op = DBC_LTE;
@ -150,15 +162,16 @@ com_stop(wordlist *wl)
d->db_value2 = val; d->db_value2 = val;
} }
else { else {
d->db_nodename2 = copy(wl->wl_word);
d->db_nodename2 = copy(wl->wl_word);
} }
} }
wl = wl->wl_next; wl = wl->wl_next;
}
else {
} else { // Neither "after" nor "when".
goto bad; goto bad;
} }
} /* end of case of word "when" */
} else {
goto bad;
}
} /* end of loop over wordlist */ } /* end of loop over wordlist */
if (thisone) { if (thisone) {
@ -178,7 +191,12 @@ com_stop(wordlist *wl)
bad: bad:
fprintf(cp_err, "Syntax error parsing breakpoint specification.\n"); fprintf(cp_err, "Syntax error parsing breakpoint specification.\n");
} /* end of funtion com_stop */
while (thisone) {
d = thisone->db_also;
txfree(thisone);
thisone = d;
}
} /* end of function com_stop */

Loading…
Cancel
Save