mirror of
https://github.com/janet-lang/janet
synced 2024-11-29 03:19:54 +00:00
Fix debug/break search algorithm.
This commit is contained in:
parent
9d020c3ec5
commit
45dfc7cc96
@ -802,28 +802,28 @@ Janet janet_asm_decode_instruction(uint32_t instr) {
|
|||||||
case JINT_SU:
|
case JINT_SU:
|
||||||
case JINT_SD:
|
case JINT_SD:
|
||||||
ret = tup3(name,
|
ret = tup3(name,
|
||||||
janet_wrap_integer(oparg(1, 0xFF)),
|
janet_wrap_integer(oparg(1, 0xFF)),
|
||||||
janet_wrap_integer(oparg(2, 0xFFFF)));
|
janet_wrap_integer(oparg(2, 0xFFFF)));
|
||||||
break;
|
break;
|
||||||
case JINT_SI:
|
case JINT_SI:
|
||||||
case JINT_SL:
|
case JINT_SL:
|
||||||
ret = tup3(name,
|
ret = tup3(name,
|
||||||
janet_wrap_integer(oparg(1, 0xFF)),
|
janet_wrap_integer(oparg(1, 0xFF)),
|
||||||
janet_wrap_integer((int32_t)instr >> 16));
|
janet_wrap_integer((int32_t)instr >> 16));
|
||||||
break;
|
break;
|
||||||
case JINT_SSS:
|
case JINT_SSS:
|
||||||
case JINT_SES:
|
case JINT_SES:
|
||||||
case JINT_SSU:
|
case JINT_SSU:
|
||||||
ret = tup4(name,
|
ret = tup4(name,
|
||||||
janet_wrap_integer(oparg(1, 0xFF)),
|
janet_wrap_integer(oparg(1, 0xFF)),
|
||||||
janet_wrap_integer(oparg(2, 0xFF)),
|
janet_wrap_integer(oparg(2, 0xFF)),
|
||||||
janet_wrap_integer(oparg(3, 0xFF)));
|
janet_wrap_integer(oparg(3, 0xFF)));
|
||||||
break;
|
break;
|
||||||
case JINT_SSI:
|
case JINT_SSI:
|
||||||
ret = tup4(name,
|
ret = tup4(name,
|
||||||
janet_wrap_integer(oparg(1, 0xFF)),
|
janet_wrap_integer(oparg(1, 0xFF)),
|
||||||
janet_wrap_integer(oparg(2, 0xFF)),
|
janet_wrap_integer(oparg(2, 0xFF)),
|
||||||
janet_wrap_integer((int32_t)instr >> 24));
|
janet_wrap_integer((int32_t)instr >> 24));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef oparg
|
#undef oparg
|
||||||
|
@ -74,7 +74,8 @@ void janet_debug_find(
|
|||||||
int32_t line = def->sourcemap[i].line;
|
int32_t line = def->sourcemap[i].line;
|
||||||
int32_t column = def->sourcemap[i].column;
|
int32_t column = def->sourcemap[i].column;
|
||||||
if (line <= sourceLine && line >= best_line) {
|
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_line = line;
|
||||||
best_column = column;
|
best_column = column;
|
||||||
besti = i;
|
besti = i;
|
||||||
@ -89,6 +90,9 @@ void janet_debug_find(
|
|||||||
if (best_def) {
|
if (best_def) {
|
||||||
*def_out = best_def;
|
*def_out = best_def;
|
||||||
*pc_out = besti;
|
*pc_out = besti;
|
||||||
|
if (best_def->name) {
|
||||||
|
janet_printf("name: %S\n", best_def->name);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
janet_panic("could not find breakpoint");
|
janet_panic("could not find breakpoint");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user