chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Line numbers in error output?


From: J Altfas
Subject: Re: [Chicken-users] Line numbers in error output?
Date: Sat, 06 Jul 2013 16:33:45 -0700

> On Sat, 6 Jul 2013 23:27:38 +0200, Peter Bex <address@hidden> 
wrote:

> On Sat, Jul 06, 2013 at 02:16:16PM -0700, J Altfas wrote:
> > Error: (string-append) bad argument type - not a string: ()
> > 
> >         Call history:
> > 
> >         httm.scm:42: indent-sz
> >         httm.scm:42: make-string
> >         httm.scm:87: ##sys#print
> >         httm.scm:87: ##sys#print
> >         httm.scm:87: ##sys#print
> >         httm.scm:87: ##sys#write-char-0
> >         httm.scm:90: html-eol
> >         httm.scm:87: ##sys#print
> >         httm.scm:87: get-output-string
> >         httm.scm:83: tloop
> >         httm.scm:94: htmatch
> >         httm.scm:39: ->string
> >         httm.scm:39: common#strcat
> >         httm.scm:39: attrloop
> >         httm.scm:39: ->string
> >         httm.scm:39: common#strcat              <--
> > 
> > True enough, string-append chokes when feeding it a non-string, 
but the issue is the trace showing the series of calls bouncing 
around in a loop in httm, whereas the error's instigator (where the 
not-a-string was wrongly supplied) was maybe several frames up in 
the series of procedural calls.
> 
> That happens occasionally, and is annoying.  Perhaps this helps: 
you can
> start any CHICKEN program (including a script via command line 
arguments
> to csi) by invoking it with -:? and it'll show you how to set 
various
> run-time options.  One of them is -:aX which sets the number of 
entries
> to be kept in the call chain buffer to the value of X.  By 
increasing it
> you may be able to view the error's root cause more easily.

Yes, I've used -:aN argument to give a longer trace with compiled 
programs.  But in the present case I have a couple of problems with 
using ":-" arguments.

One issue is when I used it before, the trace might have to be very 
long to catch the offender, and even dozens of lines would not be 
enough.  Beyond a manageable limit of lines printed, the trace 
wouldn't be helpful.

However, the bigger (and current) problem involves using the 
embedding API, that is, Scheme embedded in C.  In this case, the 
command line args are handed to the C main() function, which parses 
argv[] for the inputs it uses, and later calls the Chicken 
initialization functions.

Despite scouring the documentation, it's still unclear how the -:xx 
command-line options can be passed to the Chicken runtime (e.g., to 
affect the trace length, etc.).  While the embedding API has been 
effective and pleasant to use once I got the hang of it, this part 
remains a mystery to me.

> > Which leads to the idea that what Chicken really needs is a 
full-fledged debugger.  I realize it's been a subject often 
discussed, yet still seems to be an elusive goal.
> 
> Well, nobody's stopping you from building one ;)
> 
> Cheers,
> Peter

Ah, were I only masterful enough to grapple with it!  While I'm 
never opposed to challenges and learning something new, I fear such 
a task would present a steep curve indeed, especially since at this 
moment I'm not sure exactly where one begins.  And I suspect that 
would be kinda hard to figure out.

Jules Altfas.

reply via email to

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