[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
alloca, continuations and debug info
From: |
Neil Jerram |
Subject: |
alloca, continuations and debug info |
Date: |
Fri, 27 Aug 2004 00:15:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux 2.4.4-4GB i686; en-US; 0.8.1) Gecko/20010515 |
I just traced a crash while displaying a backtrace to a build problem
whereby the alloca.c in libguile is unnecessarily picked up (on Windows
2000, which actually has alloca defined as a macro). And I was
wondering whether it would be better to remove libguile/alloca.c
altogether from the distribution.
The problem with the "portable" implementation of alloca in
libguile/alloca.c is that the memory which it allocates is not on the
stack. Therefore, if you capture a continuation while running the debug
evaluator, then invoke the continuation, then do something to cause a
backtrace, the scm_t_debug_info's are likely to be garbage because they
weren't properly saved and restored by the continuation code.
So on any platform which needs libguile/alloca.c - because that platform
doesn't have a proper alloca - Guile may crash. I therefore suggest
maybe removing libguile/alloca.c from the distribution, and considering
other options for the places where alloca is used:
- On platforms that have GCC but not alloca (if this is possible), Guile
could use GCC's ability to declare variable sized arrays on the stack
instead.
- Or if GCC not available, Guile could declare a constant sized array
for the scm_t_debug_info's.
- As a last resort, you could just say: no proper alloca, no Guile!
Regards,
Neil
- alloca, continuations and debug info,
Neil Jerram <=