From 9af44f959b1591daf2f7d2953dbdd3e868044d27 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 14 Nov 2011 21:45:19 +0200 Subject: Bug fix in debugger - switch/case line numbers. --- debug.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 29ce8b1a..0a66b462 100644 --- a/debug.c +++ b/debug.c @@ -2231,6 +2231,23 @@ set_breakpoint_at(INSTRUCTION *rp, int lineno, int silent) INSTRUCTION *ip, *prevp; for (prevp = rp, ip = rp->nexti; ip; prevp = ip, ip = ip->nexti) { + if (ip->opcode == Op_K_case) { + INSTRUCTION *i1, *i2; + + /* Special case: the code line numbers for a switch do not form + * a monotonically increasing sequence. Check if the line # is between + * the first and last statements of the case block before continuing + * the search. + */ + for (i2 = ip->stmt_start, i1 = i2->nexti; i2 != ip->stmt_end; + i2 = i1, i1 = i1->nexti) { + if (i1->source_line >= lineno) + return add_breakpoint(i2, i1, rp->source_file, silent); + if (i1 == ip->stmt_end) + break; + } + } + if (ip->source_line >= lineno) return add_breakpoint(prevp, ip, rp->source_file, silent); if (ip == (rp + 1)->lasti) -- cgit v1.2.3 From 3ba2f61ff006c308a904c8b1a4bc433082ce87c8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 6 Dec 2011 22:00:44 +0200 Subject: Misc fixes from John. --- debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 0a66b462..ea652478 100644 --- a/debug.c +++ b/debug.c @@ -498,8 +498,8 @@ source_find(char *src) efree(path); return s; } - efree(path); } + efree(path); } d_error(_("cannot find source file named `%s' (%s)"), src, strerror(errno_val)); -- cgit v1.2.3