diff options
author | Andy Wingo <wingo@pobox.com> | 2010-07-15 12:44:15 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-07-15 12:44:15 +0200 |
commit | 41e49280f37c350106719d8377a4dc2390caf0a7 (patch) | |
tree | eacca18c876dbc20ee42ef592d79459a67bcbf32 /libguile/vm-engine.c | |
parent | 867961f9798d2d6ce398e2d14f8a9dc01cf20ae7 (diff) | |
download | guile-41e49280f37c350106719d8377a4dc2390caf0a7.tar.gz |
better error reporting from the vm
* libguile/vm-engine.c: Add func_name local, for error reporting.
(vm_error_apply_to_non_list): New error case.
(vm_error_wrong_type_arg): Remove this generic error case.
(vm_error_wrong_type_apply): Remove FUNC_NAME -- no sense in seeing
"vm-debug-engine" in the error report.
(vm_error_not_a_pair, vm_error_not_a_bytevector)
(vm_error_not_a_struct, vm_error_not_a_thunk): Use func_name instead
of FUNC_NAME, so we can indicate what caused the error.
* libguile/vm-i-scheme.c (VM_VALIDATE_CONS, car, cdr, set-car!)
(set-cdr!): Indicate provenance of errors.
(VM_VALIDATE_STRUCT, struct-vtable):
(VM_VALIDATE_BYTEVECTOR, BV_FIXABLE_INT_REF, BV_INT_REF)
(BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Same.
* libguile/vm-i-system.c (apply, tail-apply): Use
vm_error_apply_to_non_list.
Diffstat (limited to 'libguile/vm-engine.c')
-rw-r--r-- | libguile/vm-engine.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 11981ba30..7f4641a07 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -53,6 +53,7 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) /* Internal variables */ int nvalues = 0; + const char *func_name = NULL; /* used for error reporting */ SCM finish_args; /* used both for returns: both in error and normal situations */ #ifdef HAVE_LABELS_AS_VALUES @@ -142,9 +143,9 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) err_msg = scm_from_locale_string ("VM: Unbound variable: ~s"); goto vm_error; - vm_error_wrong_type_arg: - err_msg = scm_from_locale_string ("VM: Wrong type argument"); - finish_args = SCM_EOL; + vm_error_apply_to_non_list: + scm_error (scm_arg_type_key, "apply", "Apply to non-list: ~S", + finish_args, finish_args); goto vm_error; vm_error_kwargs_length_not_even: @@ -181,7 +182,7 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) vm_error_wrong_type_apply: SYNC_ALL (); - scm_error (scm_arg_type_key, FUNC_NAME, "Wrong type to apply: ~S", + scm_error (scm_arg_type_key, NULL, "Wrong type to apply: ~S", scm_list_1 (program), scm_list_1 (program)); goto vm_error; @@ -205,25 +206,25 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs) vm_error_not_a_pair: SYNC_ALL (); - scm_wrong_type_arg_msg (FUNC_NAME, 1, finish_args, "pair"); + scm_wrong_type_arg_msg (func_name, 1, finish_args, "pair"); /* shouldn't get here */ goto vm_error; vm_error_not_a_bytevector: SYNC_ALL (); - scm_wrong_type_arg_msg (FUNC_NAME, 1, finish_args, "bytevector"); + scm_wrong_type_arg_msg (func_name, 1, finish_args, "bytevector"); /* shouldn't get here */ goto vm_error; vm_error_not_a_struct: SYNC_ALL (); - scm_wrong_type_arg_msg (FUNC_NAME, 1, finish_args, "struct"); + scm_wrong_type_arg_msg (func_name, 1, finish_args, "struct"); /* shouldn't get here */ goto vm_error; vm_error_not_a_thunk: SYNC_ALL (); - scm_wrong_type_arg_msg (FUNC_NAME, 1, finish_args, "thunk"); + scm_wrong_type_arg_msg ("dynamic-wind", 1, finish_args, "thunk"); /* shouldn't get here */ goto vm_error; |