From 341896786c604d3f37e3095cdef16d786192f014 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 20 Jul 2022 09:22:40 +0200 Subject: vm: gracefully handle unresolved upvalues Upcoming module support will rely on upresolved upvalues which are patched at runtime to realize module imports, make sure the VM trace code does not choke on such unresolved upvalues. Signed-off-by: Jo-Philipp Wich --- vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 0529ee3..d0fe80e 100644 --- a/vm.c +++ b/vm.c @@ -345,7 +345,10 @@ uc_vm_frame_dump(uc_vm_t *vm, uc_callframe_t *frame) fprintf(stderr, " [%zu] <%p> %s ", i, (void *)ref, uc_vm_format_val(vm, v)); - if (ref->closed) { + if (!ref) { + fprintf(stderr, "{unresolved}\n"); + } + else if (ref->closed) { fprintf(stderr, "{closed} %s\n", uc_vm_format_val(vm, ref->value)); } -- cgit v1.2.3