guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging embeded scheme


From: Viktor Pavlenko
Subject: Re: Debugging embeded scheme
Date: Sat, 3 Apr 2004 00:08:46 -0500

>>>>> "LV" == Linas Vepstas <address@hidden> writes:

    LV> Hi,
                                                                                
    LV> I'm having a miserable time figuring out how to debug embeded
    LV> scheme/guile.  I just can't figure out how to get meaningful
    LV> debugging info.  Let me explain what the problem is:
                                                                                
    LV> [...]
                                                                                
    LV> static SCM
    LV> my_catch_handler (void *data, SCM tag, SCM throw_args)
    LV> {
    LV>    printf ("Error: GnoTime caught error during scheme parse\n");
    LV>    if (SCM_SYMBOLP(tag))
    LV>    {
    LV>       char * str  = SCM_SYMBOL_CHARS (tag);
    LV>       printf ("\tScheme error was: %s\n", str);
    LV>    }
    LV>    scm_backtrace();
    LV>    return SCM_EOL;
    LV> }

I don't know how to get backtrace but printing throw_args may help.

I find using a function similar to this often during debugging:

std::string
obj2str( const SCM& object )
{
    SCM fmt = scm_makfrom0str( "~S" );
    SCM s_str = scm_simple_format( SCM_BOOL_F, fmt, SCM_LIST1(object) );
    return SCM_STRING_CHARS( s_str );
}

-- 
Viktor




reply via email to

[Prev in Thread] Current Thread [Next in Thread]