Implementing an interposer
See original GitHub issueI wanted to use wasmtime-py to implement a tool similar to ltrace
that intercepts WASI calls. Here’s the key part of my code:
def trace(name, orig):
def trace_fn(*args):
rets = orig(*args)
print("{}{!r}->{!r}\n".format(name, args, rets))
return rets
return trace_fn
wasi = wasmtime.WasiInstance(store, "wasi_snapshot_preview1", wasi_cfg)
imports = []
for import_ in module.imports():
if import_.module() == "wasi_snapshot_preview1":
export = wasi.bind(import_)
import_type = import_.type().func_type()
wrapper = wasmtime.Func(store, import_type, trace(import_.name(), export))
imports.append(wrapper.as_extern())
instance = wasmtime.Instance(module, imports)
instance.get_export("_start")()
However, this crashes almost instantly with a nested trap. I think this happens because the WASI implementation is internally using something like access_caller=True
in order to access the memory, since the pointer-like WASI arguments are just indexes into that. But it seems like there’s no way to pass the Caller
along.
Is there a good way to implement such functionality regardless?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Architecting Interposers - Semiconductor Engineering
The task the interposer performs is to electrically connect signals in different chips/chiplets. “Typically, interposers provide a bridge ...
Read more >What Is an Interposer? - Technipages
An interposer is an intermediary between the package substrate and the CPU die. It's typically made of silicon. It offers good thermal stability ......
Read more >Interposer - Wikipedia
An interposer is an electrical interface routing between one socket or connection to another. The purpose of an interposer is to spread a...
Read more >Implementation of active interposer for high-speed and low ...
This paper describes the prototype demonstration of the active interposers assembled on the waveguide film-laminated printed circuit boards. Processing and test ...
Read more >Heterogeneous Integration Using Organic Interposer ...
As the costs of advanced node silicon have risen sharply with the 7 and 5-nanometer nodes, advanced packaging is coming to a crossroad...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t believe the C API currently ever initializes the
log
levels, but that seems plausible to add! I’ll file a PR for thatOk!