MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / debug_ids

Function debug_ids

tests/all/debug.rs:1220–1334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1218#[test]
1219#[cfg_attr(miri, ignore)]
1220fn debug_ids() -> wasmtime::Result<()> {
1221 let mut config = Config::default();
1222 config.guest_debug(true);
1223 config.wasm_exceptions(true);
1224 let engine = Engine::new(&config)?;
1225 let mut store = Store::new(&engine, ());
1226 let module1 = Module::new(
1227 &engine,
1228 r#"
1229 (module
1230 (memory 1 1)
1231 (memory 1 1)
1232 (global (mut i32) (i32.const 0))
1233 (global (mut i32) (i32.const 1))
1234 (table 1 1 funcref)
1235 (table 1 1 funcref)
1236 (tag (param i32))
1237 (tag (param i64)))
1238 "#,
1239 )?;
1240
1241 let module2 = Module::new(
1242 &engine,
1243 r#"
1244 (module
1245 (memory (export "m") 1 1))
1246 "#,
1247 )?;
1248
1249 let instance1 = Instance::new(&mut store, &module1, &[])?;
1250 let instance2 = Instance::new(&mut store, &module2, &[])?;
1251 let instance3 = Instance::new(&mut store, &module1, &[])?;
1252
1253 assert_ne!(
1254 module1.debug_index_in_engine(),
1255 module2.debug_index_in_engine()
1256 );
1257 assert_ne!(
1258 instance1.debug_index_in_store(),
1259 instance2.debug_index_in_store()
1260 );
1261 assert_ne!(
1262 instance1
1263 .debug_memory(&mut store, 0)
1264 .unwrap()
1265 .debug_index_in_store(),
1266 instance1
1267 .debug_memory(&mut store, 1)
1268 .unwrap()
1269 .debug_index_in_store()
1270 );
1271 assert_ne!(
1272 instance1
1273 .debug_memory(&mut store, 0)
1274 .unwrap()
1275 .debug_index_in_store(),
1276 instance2
1277 .debug_memory(&mut store, 0)

Callers

nothing calls this directly

Calls 8

OkFunction · 0.85
guest_debugMethod · 0.80
into_memoryMethod · 0.80
debug_memoryMethod · 0.80
newFunction · 0.50
wasm_exceptionsMethod · 0.45
unwrapMethod · 0.45
get_exportMethod · 0.45

Tested by

no test coverage detected