8000 Dwarf Debugging · Issue #169 · composablesys/wirm · GitHub
[go: up one dir, main page]

Skip to content

Dwarf Debugging #169

Open
Open

Description

@thesuhas

Need to update dwarf debugging post instrumentation to make it consistent with updated wasm binary. User must not see any debugging information related to injected code. Any debugging information present before injection must translate and give identical outcomes.

When it comes to individual debug sections:

  • debug_info: Copy it across but information related to debug_line must be updated.
  • debug_line: Update the addresses with the new locations in the wasm binary. Will need to store metadata for this.
  • All other sections: just copy

In order to generate dwarf data for handwritten .wat files, can use wasm-tools parse --generate-dwarf full

Activity

  1. linked a pull request that will close this issuedwarf debugging #137on Sep 12, 2024
  2. thesuhas commented on Sep 15, 2024

    @thesuhas
    CollaboratorAuthor

    In order to get the location information of a function, the following information can be stored.

    • At the module level, store the start location of the code section.
    • At a function level, store the start location of the function. This can be: body.range().start - number of bits used to represent function body size.
    • We must also store the end of the function. This can be from body.range().end
    • At an instruction level, store the offset in the function.

    While encoding:

    • Update the start location of the code_section.
    • As you iterate through the injected instructions, calculate the offset to be applied to later instructions and functions.
    • Now, new location of functions/instructions will just be: code_section_start + injected_delta + original_offset.

    Note: Must be careful to update the functions' size and use the updated size of that u32.
    Note 2: If locals were added to a function, need to take into account the extra space taken by them.

  3. added
    enhancement
    on Mar 12, 2026
  4. self-assigned this
    on May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0