From 74d32a166c7334cbe7aa0811ec1c6566212cd2e6 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 13 Aug 2026 07:51:56 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=BA=90=E7=A0=81=20DBG=20=E6=8F=92=E6=A1=A9=EF=BC=8C.gitignor?= =?UTF-8?q?e=20=E5=BF=BD=E7=95=A5=20wiki=20=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AstTest/LLvmLiteTest/SysLibTest 移除定位阶段残留的 printf/testcheck 插桩 (DBG1-DBG14),SlotsBugTest 空行清理;.gitignore 追加 /wiki/,TODO 更新。 --- .gitignore | 2 ++ TODO | 2 +- Test/AstTest/App/main.vp | 6 +----- Test/LLvmLiteTest/App/main.vp | 14 -------------- Test/SlotsBugTest/App/main.vp | 1 - Test/SysLibTest/App/syslibtest_impl.vp | 11 ----------- 6 files changed, 4 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 7220377..2730a94 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,5 @@ Undo/vmware/ **/temp/ **/.tpv_build/ +# wiki +/wiki/ \ No newline at end of file diff --git a/TODO b/TODO index 91b4a0a..d9628a0 100644 --- a/TODO +++ b/TODO @@ -44,4 +44,4 @@ TPV 避免虚类问题,参见 ast/base.vp:224行 TPV 虚类判断问题,参见 ast/parser.vp:2037行 替换式实现注入猴子,带有含函数指针检测和函数指针还原 - +高级 define(时间戳,版本,config项) diff --git a/Test/AstTest/App/main.vp b/Test/AstTest/App/main.vp index be6edaf..8fd4d29 100644 --- a/Test/AstTest/App/main.vp +++ b/Test/AstTest/App/main.vp @@ -171,25 +171,21 @@ class Point: printf("Parsing comprehensive source...\n") - # 解析(临时插桩:拆分 ast.parse 各阶段,定位崩溃点,定位后恢复) + # 解析 ast._init_tables(pool) - printf("DBG1 init_tables done\n") lx_dbg: t.CPtr = ast.new_lexer(pool) if lx_dbg == None: printf("FAIL: new_lexer returned None\n") stdlib.free(pool_mem) stdlib.free(dump_mem) return 1 - printf("DBG2 new_lexer done\n") ast._lexer_init(lx_dbg, src, pool) - printf("DBG3 lexer_init done\n") tokens_dbg: t.CPtr = ast.tokenize(lx_dbg) if tokens_dbg == None: printf("FAIL: tokenize returned None\n") stdlib.free(pool_mem) stdlib.free(dump_mem) return 1 - printf("DBG4 tokenize done\n") tree: ast.AST | t.CPtr = ast.parse_tokens(pool, tokens_dbg) if tree == None: printf("FAIL: parse returned None\n") diff --git a/Test/LLvmLiteTest/App/main.vp b/Test/LLvmLiteTest/App/main.vp index a8c2c17..f9ba474 100644 --- a/Test/LLvmLiteTest/App/main.vp +++ b/Test/LLvmLiteTest/App/main.vp @@ -97,50 +97,36 @@ def test_build_add(pool: memhub.MemPool | t.CPtr): core: llvmlite.LLVMTypeCore | t.CPtr = llvmlite.LLVMTypeCore(pool) mcore: llvmlite.LLVMModuleCore | t.CPtr = llvmlite.LLVMModuleCore(pool) ty_i32: llvmlite.LLVMType | t.CPtr = core.Int32() - testcheck.info("DBG: step1 core/ty_i32 ok") # 创建模块 + 函数 mod: llvmlite.Module | t.CPtr = mcore.NewModule("test_add") - testcheck.info("DBG: step2 NewModule ok") func: llvmlite.Function | t.CPtr = mcore.CreateFunction(mod, "add", ty_i32) - testcheck.info("DBG: step3 CreateFunction ok") # 添加参数 mcore.AddParam(func, ty_i32, "%a") - testcheck.info("DBG: step4 AddParam a ok") mcore.AddParam(func, ty_i32, "%b") - testcheck.info("DBG: step5 AddParam b ok") # 创建 entry 块 entry: llvmlite.BasicBlock | t.CPtr = mcore.CreateBlock(func, "entry") - testcheck.info("DBG: step6 CreateBlock ok") # 创建 builder builder: llvmlite.IRBuilder | t.CPtr = mcore.NewBuilder(func) - testcheck.info("DBG: step7 NewBuilder ok") llvmlite.position_at_end(builder, entry) - testcheck.info("DBG: step8 position_at_end ok") # 为参数创建 Value 包装 v_a: llvmlite.Value | t.CPtr = mcore.SSAValue(ty_i32, "%a") - testcheck.info("DBG: step9 SSAValue a ok") v_b: llvmlite.Value | t.CPtr = mcore.SSAValue(ty_i32, "%b") - testcheck.info("DBG: step10 SSAValue b ok") # %0 = add i32 %a, %b v_c: llvmlite.Value | t.CPtr = llvmlite.build_add(builder, v_a, v_b) - testcheck.info("DBG: step11 build_add ok") # ret i32 %0 llvmlite.build_ret(builder, v_c) - testcheck.info("DBG: step12 build_ret ok") # 打印函数 buf: t.CChar | t.CPtr = pool.alloc(4096) - testcheck.info("DBG: step13 pool.alloc buf ok") buf[0] = 0 mcore.PrintFunction(buf, 4096, func) - testcheck.info("DBG: step14 PrintFunction ok") testcheck.info(buf) # 验证关键内容 diff --git a/Test/SlotsBugTest/App/main.vp b/Test/SlotsBugTest/App/main.vp index 7f26a14..09f5a3d 100644 --- a/Test/SlotsBugTest/App/main.vp +++ b/Test/SlotsBugTest/App/main.vp @@ -15,6 +15,5 @@ class Result: self.count_node: ast.AST | t.CPtr = count self.is_pointer: bool = flag - def main() -> int: return 0 diff --git a/Test/SysLibTest/App/syslibtest_impl.vp b/Test/SysLibTest/App/syslibtest_impl.vp index 7ea841b..3318afa 100644 --- a/Test/SysLibTest/App/syslibtest_impl.vp +++ b/Test/SysLibTest/App/syslibtest_impl.vp @@ -34,41 +34,30 @@ TEST_MOVE: t.CDefine = "__sylibtest_moved.txt" def _cleanup(): """清理可能残留的测试文件/目录""" - testcheck.info("DBG: cleanup start") if os_backend.os_exists(TEST_DIR): - testcheck.info("DBG: cleanup rmdir TEST_DIR") os.rmdir(TEST_DIR) - testcheck.info("DBG: cleanup after TEST_DIR") if os_backend.os_exists(TEST_FILE): os_backend.os_remove(TEST_FILE) - testcheck.info("DBG: cleanup after TEST_FILE") if os_backend.os_exists(TEST_COPY): os_backend.os_remove(TEST_COPY) - testcheck.info("DBG: cleanup after TEST_COPY") if os_backend.os_exists(TEST_MOVE): os_backend.os_remove(TEST_MOVE) - testcheck.info("DBG: cleanup after TEST_MOVE") if os_backend.os_exists(TEST_TREE): - testcheck.info("DBG: cleanup rmtree TEST_TREE") shutil.rmtree(TEST_TREE) - testcheck.info("DBG: cleanup done") def run() -> CInt: buf: bytes = stdlib.malloc(512) testcheck.begin("SysLibTest: 系统兼容层库测试") - testcheck.info("DBG: after begin") # 清理残留 _cleanup() - testcheck.info("DBG: after cleanup") # ============================================================================= # 全局 MBuddy 初始化验证(在 main 中已初始化) # ============================================================================= testcheck.section("全局 MBuddy 初始化验证") - testcheck.info("DBG: after section") testcheck.check(os._mbuddy != None, "os._mbuddy initialized OK", "os._mbuddy NOT initialized") testcheck.check(sys._mbuddy != None, "sys._mbuddy initialized OK", "sys._mbuddy NOT initialized")