1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

Fix debug/break search algorithm.

This commit is contained in:
Calvin Rose 2019-09-22 18:08:38 -05:00
parent 9d020c3ec5
commit 45dfc7cc96
2 changed files with 15 additions and 11 deletions

View File

@ -74,7 +74,8 @@ void janet_debug_find(
int32_t line = def->sourcemap[i].line;
int32_t column = def->sourcemap[i].column;
if (line <= sourceLine && line >= best_line) {
if (column <= sourceColumn && column > best_column) {
if (column <= sourceColumn &&
(line > best_line || column > best_column)) {
best_line = line;
best_column = column;
besti = i;
@ -89,6 +90,9 @@ void janet_debug_find(
if (best_def) {
*def_out = best_def;
*pc_out = besti;
if (best_def->name) {
janet_printf("name: %S\n", best_def->name);
}
} else {
janet_panic("could not find breakpoint");
}