Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb][swift] Filter await-resume funclets when setting breakpoints #8319

Open
wants to merge 2 commits into
base: stable/20230725
Choose a base branch
from

Commits on Mar 14, 2024

  1. [lldb] Allow languages to filter breakpoints set by line (llvm#83908)

    Some languages may create artificial functions that have no real user
    code, even though there is line table information for them. One such
    case is with coroutine code that receives the CoroSplitter
    transformation in LLVM IR. That code transformation creates many
    different Functions, cloning one Instruction into many Instructions in
    many different Functions and copying the associated debug locations.
    
    It would be difficult to make that pass delete debug locations of cloned
    instructions in a language agnostic way (is it even possible?), but LLDB
    can ignore certain locations by querying its Language APIs and having it
    decide based on, for example, mangling information.
    
    (cherry picked from commit 0adccd1)
    felipepiovezan committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    265ab8d View commit details
    Browse the repository at this point in the history
  2. [lldb][swift] Filter await-resume funclets when setting breakpoints

    These funclets only serve to `task_dealloc` previously allocated tasks when
    returning from an async call, and immediately `task_switch` to the next
    await-suspend funclet (which contains real user code).
    
    By not filtering out these funclets, any breakpoint on a line with an async call
    will cause execution to pause 3 times: once before the call, twice when
    "returning" from the call, which makes for a confusing experience.
    
    The patch does the filtering on `BreakpointResolver::SetSCMatchesByLine`, which
    is the common code between BreakpointResolverFileLine and
    BreakpointResolverFileRegex.
    
    We also considered changing the debug line information in any of the many
    different lowering stages the swift compiler, but this turned out to be very
    complex to do in a targeted way; more often than not, a handful of early-IR
    coroutine instructions get expanded into multiple function clones, all
    inheriting the same debug line information. The current approach also has the
    advantaged of being easily reversible if we decide to do so.
    felipepiovezan committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    b98b5a3 View commit details
    Browse the repository at this point in the history