debug(fat32): handle_alloc 表满诊断加 handle_table 地址——定位 BSS 相邻越界写源

This commit is contained in:
TermiNexus committed 2026-08-27 01:27:38 +08:00
1 parent 8f15455784
commit e49c74fb12
1 file changed
+4 -4
@@ -1716,11 +1716,11 @@ def handle_alloc() -> fileobj | t.CPtr:
for i in range(MAX_HANDLES):
if not handle_table[i].is_open:
return c.Addr(handle_table[i])
# [DIAG] 表满定位:打印 handles_initialized 与前几个 handle 的 is_open
_dha: t.CArray[t.CChar, 96]
viperlib.snprintf(c.Addr(_dha), 96, "[handle] full init=%d h0=%d h1=%d h2=%d h3=%d\n",
# [DIAG] 表满定位:打印 handles_initialized 与前几个 handle 的 is_open + 表地址
_dha: t.CArray[t.CChar, 120]
viperlib.snprintf(c.Addr(_dha), 120, "[handle] full init=%d h0=%d h1=%d h2=%d h3=%d addr=0x%lx\n",
handles_initialized, handle_table[0].is_open, handle_table[1].is_open,
handle_table[2].is_open, handle_table[3].is_open)
handle_table[2].is_open, handle_table[3].is_open, t.CUInt64T(c.Addr(handle_table[0])))
serial.puts(c.Addr(_dha))
return None