summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-07-20 09:22:40 +0200
committerJo-Philipp Wich <jo@mein.io>2022-07-30 00:41:56 +0200
commit341896786c604d3f37e3095cdef16d786192f014 (patch)
treef5649f740110257ef180b3b3fc4c67dd05b74538 /vm.c
parent50cf5723f9d41a5a65a6f5d38f8dfff4ff9422a5 (diff)
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 <jo@mein.io>
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c5
1 files changed, 4 insertions, 1 deletions
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));
}