Skip to content

debug_drop_sites.lldb breaks before address filters and loses backtrace commands #1160

Closed

Description

@ehartford

tools/debug_drop_sites.lldb does not provide the advertised address-filtered
allocation/free backtraces.

During the #1158 investigation, a run with WITH_DEBUG_ALLOC=1 and
WITH_DEBUG_ALLOC_TRAP_FREE=4712080096 stopped on every invocation of
dbg_trap_alloc_check/dbg_trap_free_check, including unrelated addresses.
The helper sets entry breakpoints, before each function's address comparison.
Its repeated --one-liner options also leave only the final continue,
discarding the expected bt command.

The exact same binary and environment produced the intended lifetime history
when breakpoints were placed after the filter, at dbg_trap_alloc_check +108
and dbg_trap_free_check +116, using --command "bt 12" --auto-continue true.
Those offsets are diagnostic evidence, not a portable fix: the product helper
should bind a stable post-filter site and verify its command list.

Expected: only the selected address triggers a stack, for every allocation and
free, followed by the final double-free report. Add a reproducible helper
smoke test so a future silent/noisy debugger route cannot pass unnoticed.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced in source for the filter half. tools/debug_drop_sites.lldb now uses command lists (thread backtrace -c 12, continue), so the backtraces survive. But it still breaks on entry to dbg_trap_free_check / dbg_trap_alloc_check, and rt/rt_core.w:1774 calls the check on every free; the address comparison is inside the function (:1238), after the breakpoint.

    post-release: a debugging-tool fix (break after the compare, or guard the call).

  2. added this to the post-v0.16.0 milestone on Oct 28, 2026
  3. ehartford commented on Nov 11, 2026

    @ehartford
    ContributorAuthor

    Fixed since filing; verified on main 6ea2ec2 with the header's recipe 2 on a real double free (test/debug_alloc/da_3103_large_block_double_free_reported.w, built with with build):

    • tools/debug_drop_sites.lldb breaks on dbg_trap_hit (by regex, so the release binary's mangled name binds), which the runtime calls only after its address filter; the command list is thread backtrace -c 12 + continue.
    • lldb --batch -s tools/debug_drop_sites.lldb -o "settings set target.env-vars WITH_DEBUG_ALLOC=1 WITH_DEBUG_ALLOC_TRAP_FREE=4296228880" -o run -o "bt 6" -o quit -- ./df: 8 stops, every one an event of that address (trap-alloc hit=1, trap-release, trap-free hit=1, …), each followed by its backtrace through dbg_trap_alloc_check / dbg_trap_count_check / dbg_trap_free_check into the program's line, then the DOUBLE FREE report.

    The requested smoke test is not added to the build: lldb is a host tool and the toolchain's own targets run none (D171, law 8). The trap the helper rides on is exercised by the debug-allocator lane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions