[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Debugging embeded scheme
From: |
Linas Vepstas |
Subject: |
Debugging embeded scheme |
Date: |
Fri, 2 Apr 2004 22:31:28 -0600 |
User-agent: |
Mutt/1.5.4i |
Hi,
I'm having a miserable time figuring out how to debug embeded
scheme/guile. I just can't figure out how to get meaningful
debugging info. Let me explain what the problem is:
Application is GnoTime (gttr.sourceforge.net)
The pseudocode is roughly:
scm_c_define_gsubr(...) /* 20 or 30 of these */
scm_c_primitive_load ("/wherever/gtt.scm");
while () {
gh_eval_str_with_catch (str, my_catch_handler);
}
where I use the following:
static SCM
my_catch_handler (void *data, SCM tag, SCM throw_args)
{
printf ("Error: GnoTime caught error during scheme parse\n");
if (SCM_SYMBOLP(tag))
{
char * str = SCM_SYMBOL_CHARS (tag);
printf ("\tScheme error was: %s\n", str);
}
scm_backtrace();
return SCM_EOL;
}
As long as things were simple, I could "guess" where the bug was;
but its now gotten out of control. The above setup gives me output
that is unhelpful to the extreme: gtt.scm is several hundred lines
long, and the embeded stuff in gh_eval_str_with_catch() is dozens
of lines longer. And all I get is:
Error: GnoTime caught error during scheme parse
Scheme error was: unbound-variable
No backtrace available.
Error: GnoTime caught error during scheme parse
Scheme error was: misc-error
No backtrace available.
Error: GnoTime caught error during scheme parse
Scheme error was: wrong-type-arg
No backtrace available.
Adding things like
(trace (my-fun)) is what produced the first unbound-variable.
Although clearly my-fun is defined and works fine...
After googling, I tried adding things like
(debug-enable 'debug 'backtrace) and all I got
for my efforts was a flat out crash:
ERROR: In procedure debug-options-interface:
ERROR: Unknown mode flag: debug
Program exited with code 02.
I am trying to decipher the gh_stack_trace type functions right now,
but I thought I'd ask on the mailing list ... It sure would be nice
if the guile documentation actually described how to use this stuff.
I'm also looking at scm_display_backtrace() but I can't figure out
how to use 'ports' (since my app does no i/o; there's no stdin/stdout,
since its a graphical app. ). I'm also staring at
scm_internal_stack_catch() but with a name like that, can't figure out
if its legal for apps to use it or not.
--linas.
--
pub 1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <address@hidden>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984 3F54 64A9 9A82 0104 5933
- Debugging embeded scheme,
Linas Vepstas <=