Files
TransPyC/debug-phase1-scan-crash.md
T
2026-08-22 02:35:30 +08:00

40 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Debug Session: phase1-scan-crash
状态: [OPEN]
## 症状
- TPV(asan 构建,9:27 重建,含 50bd1f5/b1d4d3a)编译项目时,Phase1 includes 扫描完成
(`扫描: _dict/_fakeduck/_list/_variant/_withcontent.vp` 等最后输出)后崩溃
- 崩溃无 ASAN 堆栈(exe 确认插桩 22611 处、链接 asan 库正常)
- H1(CTypedef 垃圾串)与 M3(builtins 1 字节越界)修复后依然崩溃
## 时间线
- 08:50 asan 构建(含 BuildCombinedIR 并行)
- 09:14 50bd1f5 CTypedef 垃圾串修复
- 09:23 b1d4d3a M3 越界修复
- 09:27 重建 exe(含两修复)→ 仍崩
## 假设(可证伪)
- A. M6 泛型跨遍悬空:`_list[T]`/`_dict` 泛型模板预注册/特化时节点字段引用主池,
被 mark/reset 回收后读悬空 → 池内访问 ASAN 不报
- B. H2/H3 1MB IR 截断:新文件(_dict/_list 泛型特化)stub.ll/text.ll 超 1MB
PHASE1_IR_SIZE 被静默截断 → 合并畸形 → 崩溃
- C. M4 vpi 返回注解缓存 realloc 后旧指针悬空 → strcmp/strlen 读野(跨模块首次缓存窗口)
- D. Phase1 哨兵检查 / VLogger.error → exit(1) 无 ASAN(需确认崩溃前是否有 ERROR 输出)
- E. 固定宽槽 strcpy 越界:PopulateSha1MapStore 的 MAX_REL_PATH_LEN/MAX_DEPS_STR_LEN
等固定宽槽 + 新文件长路径/长依赖 → 越界写(池内无 ASAN)
## 插桩点(一次覆盖全部假设)
1. Phase1Main 1a-pre 循环:`[DBG-P1] 1a-pre: {rel_path}`(每文件,L147)
2. Phase1Main 1b 翻译前:`[DBG-P1] 1b 翻译: {file_path}`(L825)
3. Phase1Main stub dump 后:`[DBG-P1] stub_len={n} {file_path}`(L880)
4. Phase1Main text dump 后:`[DBG-P1] text_len={n} {file_path}`(L911)
5. StubMergerStore.PopulateSha1MapStore:`[DBG-P1] store_count={n} scan_count={n}`(L135)
## 插桩提交
- b133342 debug(phase1): 插桩 1a-pre/1b 翻译/stub 长度,定位扫描后无 ASAN 崩溃点
- 待用户重建(--clean --rebuild-includes --clear-cache --asan)复现,贴崩溃前最后 50 行
## 结论
(待用户重建复现后填写)