From 33db472fbf2c90395937d3dbd9c08bf591fb2ecd Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 24 Sep 2013 15:32:22 +0300 Subject: Fix core dump in debug.c for breakpoint w/o line. --- debug.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 949ebb49..357ce725 100644 --- a/debug.c +++ b/debug.c @@ -2068,12 +2068,18 @@ 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); + 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; } -- cgit v1.2.3 From da923f91d9bd8ade673a4f2f15be3d78a36b759e Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 5 Dec 2013 20:52:50 +0200 Subject: Add a FIXME comment. --- debug.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 357ce725..8df9ed0d 100644 --- a/debug.c +++ b/debug.c @@ -2068,6 +2068,11 @@ find_rule(char *src, long lineno) { INSTRUCTION *rp; + /* + * 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) -- cgit v1.2.3