summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-12-08 21:20:11 +0200
committerArnold D. Robbins <arnold@skeeve.com>2011-12-08 21:20:11 +0200
commitc5da922b0486462028584e4568d6e00d1a4f2783 (patch)
treede1d17b273449e5aa03dcbf79d53edbc0bc3b157 /debug.c
parent69239a8fd65ad7f55cc2d567c933a800d5d10fac (diff)
parentd586094c7c4a9a412a7633a32d2b92a8e1cfea1c (diff)
downloadgawk-c5da922b0486462028584e4568d6e00d1a4f2783.tar.gz
Merge branch 'gawk-4.0-stable'
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/debug.c b/debug.c
index 5870a40f..37418115 100644
--- a/debug.c
+++ b/debug.c
@@ -493,8 +493,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));
@@ -2227,6 +2227,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)