From: William Morgan <wmorgan@masanjin.net>
Subject: Re: wrong-type-arg in scm_display_backtrace
Date: Sat, 4 Jan 2003 22:57:42 -0500 [thread overview]
Message-ID: <20030105035742.GA29985@masanjin.net> (raw)
In-Reply-To: <m3el7xoiwe.fsf@laruns.ossau.uklinux.net>
Excerpts (reformatted) from Neil Jerram's mail of 31 Dec 2002 (EST):
> Is stack #f on entry to scm_display_backtrace?
Indeed, it is #f after all.
> To get scm_display_backtrace to work in your scenario, you essentially
> need to replicate the kernel of all this in C, i.e.:
>
> (lazy-catch #t
> thunk
> (lambda (args)
> (fluid-set! the-last-stack (make-stack #t))
> (apply throw args)))
Ok, this is helpful. I am starting to understand exactly what I need to
be doing. Unfortunately I am still unsuccesful:
>From perusal of throw.c, it seems that scm_internal_stack_catch is what I want
to call, as it sets scm_the_last_stack_fluid_var. However, using, the stack is
always #f at the point that I hit the error handler. So what am I doing wrong
in the code below?
--- snip ---
static SCM guile_safe_apply_handler(void *data, SCM tag, SCM throw_args) {
SCM port = scm_def_errp;
if(scm_ilength(throw_args) >= 3) {
SCM stack = scm_fluid_ref(SCM_VARIABLE_REF(scm_the_last_stack_fluid_var));
SCM subr = SCM_CAR(throw_args);
SCM message = SCM_CADR(throw_args);
SCM args = SCM_CADDR(throw_args);
/* So far, I reach this point with non-user-throws exceptions (e.g.
undefined variables). But stack is invariably #f. */
scm_display_backtrace(stack, port, SCM_UNDEFINED, SCM_UNDEFINED);
return SCM_BOOL_F;
}
else {
/* I reach this point upon user-thrown exceptions. Why? */
scm_puts("uncaught throw to ", port);
scm_prin1(tag, port, 0);
}
return SCM_BOOL_T;
}
struct guile_body_apply_data {
SCM proc;
SCM args;
};
SCM guile_safe_apply_body(struct guile_body_apply_data* data) {
return scm_apply_0(data->proc, data->args);
}
SCM guile_safe_apply(SCM proc, SCM args) {
struct guile_body_apply_data data;
data.proc = proc;
data.args = args;
return scm_internal_stack_catch(SCM_BOOL_T, (scm_t_catch_body)guile_safe_apply_body, (void*)&data, (scm_t_catch_handler)guile_safe_apply_handler, NULL);
}
--- snip ---
Is scm_apply_0 the wrong thing to call in the body?
Any further help would be appreciated.
Thanks,
--
William <wmorgan@masanjin.net>
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2003-01-05 3:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-30 1:31 wrong-type-arg in scm_display_backtrace William Morgan
2002-12-31 23:42 ` Neil Jerram
2003-01-05 3:57 ` William Morgan [this message]
2003-01-06 19:06 ` Neil Jerram
2003-01-07 5:42 ` William Morgan
2003-01-08 20:21 ` Neil Jerram
2003-01-08 22:38 ` William Morgan
2003-01-09 23:42 ` Neil Jerram
2003-01-10 20:31 ` vports from c questions William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030105035742.GA29985@masanjin.net \
--to=wmorgan@masanjin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).