You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
debug allocator: record the first free's return address so DOUBLE FREE names both sites without lldb #1014
debug-alloc: DOUBLE FREE addr=… size=32 first_drop=drop#struct __drop_struct_16 second_drop=<untagged> names the first free's drop-origin tag but not its call site. Resolving the site today means lldb with a conditional breakpoint on rt_free (times out on real programs: every alloc/free with a backtrace) or a breakpoint on dbg_report_double_free (gives only the SECOND site).
Proposed: in debug-alloc mode, store the return address (and one or two frames up, via the frame pointer) at each free in the ledger entry, and print both sites symbolized (or as addresses for atos) in the DOUBLE FREE / invalid-free report. Same for the allocation site of a leaked block. This turns the most common lldb session for drop bugs into zero lldb sessions.
See docs/deep-debugging-tools.md review (2026-09-03); the 2026-09-03 spec_ss06 hunt is the motivating case.
Narrowing after reading rt/rt_core.w: the allocator already has the per-address trap — WITH_DEBUG_ALLOC_TRAP_FREE=<decimal payload addr> prints every rt alloc and free of that address with its drop origin (works without WITH_DEBUG_ALLOC, so the heap layout is unchanged), and WITH_DEBUG_ALLOC_TRAP_FREE_HIT=<n> panics on the n-th free so a debugger stops on that chain (#747 instrument, rt_core.w ~line 758). Neither docs/deep-debugging-tools.md nor CLAUDE.md mentioned it, which is being fixed in the docs commit that retires the per-allocation lldb script. What remains of this issue: record the first free's return address in the ledger entry by default so the DOUBLE FREE / invalid-free report names both sites in the first run, without a second run under the trap env.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced: still missing. dbg_report_double_free (rt/rt_core.w:1548) prints the first and second drop-origin tags and no call site for either free. The address trap (WITH_DEBUG_ALLOC_TRAP_FREE, under lldb) remains the only way to get the first site.
post-release: a debugging-tool improvement with a working route today.
Fixed in #3257 for Darwin. The ledger entry keeps the allocation's calling chain (6 frames) and the first free's (8). A DOUBLE FREE prints 'first free' and 'second free' chains; the first 16 LEAK lines print 'allocated at'. Nothing is captured off the thread's own stack (a fiber or generator stack has no caller to unwind to; the first version crashed there, exit 139, found by the battery). Linux, Windows and wasm have no in-process unwinder in the runtime yet and print the tags as before. Cost: 2,000,000 alloc/free pairs under WITH_DEBUG_ALLOC, 0.09 s to 0.19 s. Tests: da_1014_double_free_names_first_site, da_1014_leak_names_alloc_site.
Activity
ehartford commentedon Sep 4, 2026
Narrowing after reading rt/rt_core.w: the allocator already has the per-address trap —
WITH_DEBUG_ALLOC_TRAP_FREE=<decimal payload addr>prints every rt alloc and free of that address with its drop origin (works without WITH_DEBUG_ALLOC, so the heap layout is unchanged), andWITH_DEBUG_ALLOC_TRAP_FREE_HIT=<n>panics on the n-th free so a debugger stops on that chain (#747 instrument, rt_core.w ~line 758). Neither docs/deep-debugging-tools.md nor CLAUDE.md mentioned it, which is being fixed in the docs commit that retires the per-allocation lldb script. What remains of this issue: record the first free's return address in the ledger entry by default so the DOUBLE FREE / invalid-free report names both sites in the first run, without a second run under the trap env.deep-debugging-tools.md: routes by bug class, one drop-state analysis…
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced: still missing.dbg_report_double_free(rt/rt_core.w:1548) prints the first and second drop-origin tags and no call site for either free. The address trap (WITH_DEBUG_ALLOC_TRAP_FREE, under lldb) remains the only way to get the first site.post-release: a debugging-tool improvement with a working route today.
Issues batch G: #2680 #1153 #2369 #2761 #1014 (#3257)
ehartford commentedon Nov 11, 2026
Fixed in #3257 for Darwin. The ledger entry keeps the allocation's calling chain (6 frames) and the first free's (8). A DOUBLE FREE prints 'first free' and 'second free' chains; the first 16 LEAK lines print 'allocated at'. Nothing is captured off the thread's own stack (a fiber or generator stack has no caller to unwind to; the first version crashed there, exit 139, found by the battery). Linux, Windows and wasm have no in-process unwinder in the runtime yet and print the tags as before. Cost: 2,000,000 alloc/free pairs under WITH_DEBUG_ALLOC, 0.09 s to 0.19 s. Tests: da_1014_double_free_names_first_site, da_1014_leak_names_alloc_site.