aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/debug.c b/debug.c
index 2d9f74e8..9903a376 100644
--- a/debug.c
+++ b/debug.c
@@ -2068,12 +2068,23 @@ find_rule(char *src, long lineno)
{
INSTRUCTION *rp;
- assert(lineno > 0);
- for (rp = rule_list->nexti; rp != NULL; rp = rp->nexti) {
- if ((rp - 1)->source_file == src
- && lineno >= (rp + 1)->first_line
- && lineno <= (rp + 1)->last_line)
- return (rp - 1);
+ /*
+ * FIXME: The check for zero and code that goes with it
+ * are probably fragile. A break with no arguments can
+ * cause this in certain cases. Try to review how this works.
+ */
+ if (lineno == 0) {
+ for (rp = rule_list->nexti; rp != NULL; rp = rp->nexti) {
+ if ((rp - 1)->source_file == src && (rp - 1)->source_line > 0)
+ return (rp - 1);
+ }
+ } else {
+ for (rp = rule_list->nexti; rp != NULL; rp = rp->nexti) {
+ if ((rp - 1)->source_file == src
+ && lineno >= (rp + 1)->first_line
+ && lineno <= (rp + 1)->last_line)
+ return (rp - 1);
+ }
}
return NULL;
}