print ins of all line

This commit is contained in:
lyon1998 2022-03-28 22:32:34 +08:00
parent 549cbe1ba3
commit f6da565249
3 changed files with 19 additions and 3 deletions

View File

@ -18,6 +18,7 @@
"program": "${workspaceFolder}/build/test/pikascript_test",
// "program": "${workspaceFolder}/../build/src/boot/demo06-pikamain/pikascript_demo06-pikamain",
"args": [
// "--gtest_filter=pikaMain.range",
// "--gtest_filter=parser.class_def_void_line",
// "--gtest_filter=VM.WHILE_byte",
// "--gtest_filter=pikaMain.task_run_once",

View File

@ -30,7 +30,7 @@ TEST(sysObj, noMethod) {
// int errCode = args_getErrorCode(globals->list);
// printf("sysout = %s\r\n", sysOut);
// ASSERT_EQ(1, strEqu((char*)"[error] runner: method no found.", sysOut));
EXPECT_STREQ(log_buff[2], "[error] runner: method no found.\r\n");
EXPECT_STREQ(log_buff[4], "[error] runner: method no found.\r\n");
// ASSERT_EQ(2, errCode);
// obj_deinit(globals);
obj_deinit(obj);

View File

@ -1162,8 +1162,23 @@ VMParameters* pikaVM_runByteCodeWithState(PikaObj* self,
vs.pc = pikaVM_runInstructUnit(self, &vs, this_ins_unit);
if (0 != vs.error_code) {
__platform_printf("[info] input commond: \r\n");
instructUnit_printWithConst(this_ins_unit,
InstructUnit* head_ins_unit = this_ins_unit;
/* get first ins of a line */
while (1) {
if (instructUnit_getIsNewLine(head_ins_unit)) {
break;
}
head_ins_unit--;
}
/* print inses of a line */
while (1) {
instructUnit_printWithConst(head_ins_unit,
&(bytecode_frame->const_pool));
head_ins_unit++;
if (head_ins_unit > this_ins_unit) {
break;
}
}
__platform_error_handle();
}
}