bytecodealliance / wasm-tools

CLI and Rust libraries for low-level manipulation of WebAssembly modules
Apache License 2.0
1.22k stars 226 forks source link

Alternative for wasmer inspect #1554

Open svanimpe opened 1 month ago

svanimpe commented 1 month ago

I'm trying to use wasm-tools to reproduce the clear and concise overview produced by wasmer inspect. For example (abbreviated):

$ wasmer inspect module.wasm
Type: wasm
Size: 14.5 MB
Imports:
  Functions:
    "javascript_kit"."swjs_i64_to_bigint": [I64, I32] -> [I32]
    "javascript_kit"."swjs_bigint_to_i64": [I32, I32] -> [I64]
    "javascript_kit"."swjs_set_subscript": [I32, I32, I32, I32, F64] -> []
  Memories:
  Tables:
  Globals:
Exports:
  Functions:
    "_initialize": [] -> []
    "__main_argc_argv": [I32, I32] -> [I32]
    "swjs_call_host_function": [I32, I32, I32, I32] -> [I32]
    "swjs_free_host_function": [I32] -> []
  Memories:
    "memory": not shared (81 pages..)
  Tables:
  Globals:

Is this currently possible with wasm-tools?

alexcrichton commented 1 month ago

The wasm-tools CLI doesn't have anything that can directly produce this output, but is there any particular part of the output you're most interested in? This output is sort of similar to wasm-tools print | grep of sorts.