Editable locals/stack within a WebAssembly debug frame

20 views
Skip to first unread message

Elias

unread,
Sep 8, 2025, 11:19:38 AM (3 days ago) Sep 8
to v8-dev
Hi,

While it's possible to inspect WASM locals/stack through DevTools, there seems to be no way to change their values. I'm wondering if there's a reason why this was not implemented.

From my understanding, when debugging, the baseline compiler is always used, which doesn't optimize away locals (?), so that shouldn't pose a problem. wasm-debug.cc has GetValue/GetLocalValue/GetStackValue and it would look fairly trivial to implement functions for setting them, and then updating LocalsProxy/StackProxy to have a setter. The only edge case I can think of are constant values.

Am I missing something? I could not find any discussions on this topic.

Thanks!

Clemens Backes

unread,
Sep 8, 2025, 11:56:22 AM (3 days ago) Sep 8
to v8-...@googlegroups.com
One issue is indeed constant values, another issue is registers shared by multiple values on the stack, or between locals and the value stack. E.g. a `local.get` typically does not emit any code, the register which holds the local is just reused for holding the top-of-value-stack value. So you cannot modify one without modifying the other.

We already emit special "for debugging" Liftoff code, so we could make sure to always materialize constants and never share registers. It would be some work though, and adds complexity, and so far no one missed the feature to modify values while debugging Wasm.

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/v8-dev/ad58f2fe-894d-433d-b226-114cc20314a1n%40googlegroups.com.


--

Clemens Backes

Software Engineer

clem...@google.com

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian   

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.


This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.


Reply all
Reply to author
Forward
0 new messages