-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[wasm] Add wa-info tool to src/mono/wasm/tools #110565
Draft
radekdoulik
wants to merge
157
commits into
dotnet:main
Choose a base branch
from
radekdoulik:pr-rodo-add-wa-info-tool
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently it is able to read wasm modules and few sections, like Type, Imports, Exports, Function Example output: > wa-info.exe -v dotnet.wasm Reading wasm file: dotnet.wasm WebAssembly binary format version: 1 Section: Type size: 3097 count: 339 Section: Import size: 2505 count: 102 Section: Function size: 17844 count: 17703 Section: Table size: 7 Section: Memory size: 7 Section: Global size: 19 Section: Export size: 2279 count: 98 Section: Element size: 8291 Section: Code size: 2000334 Section: Data size: 508697 Section: Custom size: 840366 name: name Section: Custom size: 4063235 name: .debug_info Section: Custom size: 1436986 name: .debug_loc Section: Custom size: 141446 name: .debug_ranges Section: Custom size: 241806 name: .debug_abbrev Section: Custom size: 2032586 name: .debug_line Section: Custom size: 739480 name: .debug_str
Read function code blocks, read locals
Read function, local, global and data segment name maps
Example use: wa-info.exe -d --function-filter Json.*Measure dotnet.wasm (func Wasm_Browser_Bench_Sample_Sample_JsonTask_get_Measurements(param i32 i32) (result i32)) local 1 i32 global_get i32_const i32_sub local_tee $2 global_set local_get $0 i32_eqz if call $mini_llvmonly_throw_nullref_exception unreachable local_get $2 local_get $0 i32_load i32_store local_get $2 i32_load local_set $0 local_get $2 i32_const i32_add global_set local_get $0
The function names map includes names of imports at the beginning Fix indentation Example output: wa-info.exe -d --function-filter Wasm_Browser_Bench_Sample_Sample_ExceptionsTask_TryCatch_RunStep dotnet.wasm (func Wasm_Browser_Bench_Sample_Sample_ExceptionsTask_TryCatch_RunStep(param i32 i32)) local 1 i32 global.get i32.const 16 i32.sub local.tee $2 global.set local.get $2 local.get $0 i32.store i32.const 1997558 i32.load8.u i32.eqz if i32.const 1171316 call $mono_aot_Wasm_Browser_Bench_Sample_init_method i32.const 1997558 i32.const 1 i32.store8 i32.const 1994984 i32.load call $mini_llvmonly_get_interp_entry local.set $0 local.get $2 local.get $2 i32.load i32.store local.get $2 i32.load local.get $0 i32.load local.get $0 i32.load local.tee $0 call.indirect local.get $2 i32.const 16 i32.add global.set
Example: (func System_Private_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_Runtime_GetCSOwnedObjectByJSHandle_int_int(param i32 i32 i32) (result i32)) local 1 i32 local 1 i32 global.get $__stack_pointer i32.const 16 i32.sub local.tee $3 global.set $__stack_pointer i32.const 1947029 ...
Example: ... i32.load offset:12 align:2 i32.store offset:8 align:2 local.get $3 i32.load offset:8 align:2 local.set $0 local.get $3 i32.const 16 i32.add global.set $__stack_pointer ...
Also improve dump bytes to show canonical hex+ASCII output
Also fixes crash with some import types
Changes: * improve imports reading * improve dump bytes * show custom sections content in verbose2 mode (-vv) * introduce wa-lib assembly with the shared code
This is beginning of parsing content of custom sections in wasm obj `.o` files.
Changes: * add support for wasm object files * parse linking and relocation sections
Tagging subscribers to this area: @akoeplinger, @matouskozak |
3 tasks
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
This was referenced Feb 13, 2025
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.