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

Detailed debug-info (DWARF) support in new backends (initially x64). #2565

Merged
merged 5 commits into from
Jan 23, 2021

Commits on Jan 21, 2021

  1. Detailed debug-info (DWARF) support in new backends (initially x64).

    This PR propagates "value labels" all the way from CLIF to DWARF
    metadata on the emitted machine code. The key idea is as follows:
    
    - Translate value-label metadata on the input into "value_label"
      pseudo-instructions when lowering into VCode. These
      pseudo-instructions take a register as input, denote a value label,
      and semantically are like a "move into value label" -- i.e., they
      update the current value (as seen by debugging tools) of the given
      local. These pseudo-instructions emit no machine code.
    
    - Perform a dataflow analysis *at the machine-code level*, tracking
      value-labels that propagate into registers and into [SP+constant]
      stack storage. This is a forward dataflow fixpoint analysis where each
      storage location can contain a *set* of value labels, and each value
      label can reside in a *set* of storage locations. (Meet function is
      pairwise intersection by storage location.)
    
      This analysis traces value labels symbolically through loads and
      stores and reg-to-reg moves, so it will naturally handle spills and
      reloads without knowing anything special about them.
    
    - When this analysis converges, we have, at each machine-code offset, a
      mapping from value labels to some number of storage locations; for
      each offset for each label, we choose the best location (prefer
      registers). Note that we can choose any location, as the symbolic
      dataflow analysis is sound and guarantees that the value at the
      value_label instruction propagates to all of the named locations.
    
    - Then we can convert this mapping into a format that the DWARF
      generation code (wasmtime's debug crate) can use.
    
    This PR also adds the new-backend variant to the gdb tests on CI.
    cfallin committed Jan 21, 2021
    Configuration menu
    Copy the full SHA
    c84d6be View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    997fab5 View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2021

  1. Configuration menu
    Copy the full SHA
    7e12abc View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2021

  1. Address review comments.

    cfallin committed Jan 23, 2021
    Configuration menu
    Copy the full SHA
    f54d0d0 View commit details
    Browse the repository at this point in the history
  2. Fix GitHub Actions config (actually run gdb tests on new backend).

    I had missed that the CI config didn't actually run the tests, because
    (I think) `matrix.target` is not set by default (?). All of our hosts
    are native x86-64, so we can just gate on OS (Ubuntu) instead.
    
    I also discovered that while I had been testing with the gdb tests
    locally, when *all* `debug::*` tests are run, there are two that do not
    pass on the new backend because of specific differences in compiled
    code. One is a value-lifetime issue (the value is "optimized out" at the
    point the breakpoint is set) and the other has to do with basic-block
    order (it is trying to match against hardcoded machine-code offsets
    which have changed).
    cfallin committed Jan 23, 2021
    Configuration menu
    Copy the full SHA
    557a932 View commit details
    Browse the repository at this point in the history