guile-user
[Top][All Lists]
Advanced

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

Re: Line numbers for scm_c_primitive_load() errors


From: Mike Gran
Subject: Re: Line numbers for scm_c_primitive_load() errors
Date: Sat, 31 Mar 2018 09:09:32 -0700
User-agent: Mutt/1.9.2 (2017-12-15)

On Fri, Mar 30, 2018 at 10:30:18PM -0700, Robert Gill wrote:
> I'm trying to read a file with scm_c_primitive_load() that uses some
> custom functions defined with scm_c_define_gsubr(). If I pass an invalid
> data type to one of these functions, I get an expected exception, but
> the line number of the file where they occur is not included in the
> stack trace. I tried following the directions in the manual under
> '6.25.3.2 Capturing the full error stack', and wrapping the call in
> scm_c_catch(), while manually capturing the stack, but it still doesn't
> seem to include the line number.
> 
> I'm using guile 2.0.14.
> 

Yeah.  Guile only attaches line numbers to some of the locations in a
file, like 'define'; many of the inner expressions have no location
attached.

One strategy is to evaluate a file one expression at a time, and then
hold onto the last expression that had locations attached to it.  When an
error occurs, the last expression that had locations attached is
probably above or next to the expression causing the error.

Consider the attached program

Hope this helps

-Mike Gran

Attachment: tmp_guilelinenumber.c
Description: Text document


reply via email to

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