Skip to content

Add a wasmtime objdump subcommand #10336

@alexcrichton

Description

@alexcrichton

We talked about this in today's Cranelift meeting but I wanted to write down an issue for this idea. The basic idea is that we have *.cwasm files which have binary tables/metadata in various sections, and we only have objdump -S today to look at the .text section. Otherwise most of our other sections are not easily debuggable. Most sections, however, have something to do with the .text section, so it'd be great to be able to debug all these at the same time.

The general idea is to do something roughly along these lines:

  • Add a new subcommand, wasmtime objdump, that takes a *.cwasm file as input.
  • This primarily either use Capstone to disassemble the .text section or invokes llvm-objdump or objdump or similar. My preference would be to use Capstone to have deterministic output regardless of what's installed on the system.
  • Disasembly would then be printed in a manner similar to objdump -S, one line per instructions. The main difference is that we would weave debug views of other tables at the same time.
  • For example.wasmtime.traps would be interleaved as ;; trap = CODE after each instruction
  • Another example is .wasmtime.addrmap would ineterleave ;; @0x0FF537 to show where the instruction maps back to the original binary location.
  • The reach goal would be to integrate both stack maps and exception tables from the exception-handling proposal into this view as well. That'd ideally make it much easier to view and debug issues with stack maps and exception tables.

Ideally this view would then be used for all disas tests instead of today's "just use capstone". We could then add various --flags to this subcommand to customize exactly what's disassembled (everything? just stack maps? nothing?) along with other options like "print the instruction bytes" etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasmtimeIssues about wasmtime that don't fall into another label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions