guile-devel
[Top][All Lists]
Advanced

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

Re: Line/column numbers in user supplied exception handlers


From: Dale P. Smith
Subject: Re: Line/column numbers in user supplied exception handlers
Date: Mon, 02 Jul 2001 14:25:12 -0400

(suppposed to be bad manners to reply to your own message. Sorry.)

"Dale P. Smith" wrote:
> 
> "Dale P. Smith" wrote:
> >
> > I'm trying to catch exceptions with my own handler and generate error
> > messages that include file/line number information.  If you call the
> > attached C program with an argument of 0, 1 or 2, you get these
> > different outputs:
> 
> Well, digging around I found that scm_ithrow() checks for a catch
> handler on the scm_dynwinds list.  If it finds none, it calls
> scm_handle_by_message(), which eventually prints out the good line and
> column number stuff.  It also calls abort() right after that, but only
> if the exit() in scm_handle_by_message() doesn't do it's job. :(
> 
> If scm_ithrow() *does* find a catch handler, it does a longjmp() to the
> handler.  I tried calling handler_message() in my catch handler (it's
> what scm_handle_by_message() calls).  Well, that doesn't work either. It
> seems that there is some port saving and swapping (probably to handle
> nested load's ) going on that basically removes the file context so the
> good error printing routines have nothing to work with.  :(

I finally found something that sort of works.  If you use
scm_internal_lazy_catch() you can get at line/column information! You
just can't return from your handler. So you wrap that with another catch
and throw in your lazy catch handler.  It seems that lazy catch was made
for just this reason.

I also found this in the archives:
http://mail.gnu.org/pipermail/guile-devel/2001-May/002108.html

It sounds like a great idea.  Has anyone thought about it?

-Dale

-- 
Dale P. Smith
Treasurer, Cleveland Linux Users Group http://cleveland.lug.net
Senior Systems Consultant, Altus Technologies Corporation
address@hidden
440-746-9000 x309



reply via email to

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