Christian et al,
I ran it under gdb having rebuilt gsi / gsc with --debug and without. Little difference in either case. The attached files form the framework with the exception of the SLIB library of utilty functions. The output from gdb is in gdbout.Ran the code compiled and interpreted with no noted difference.
Nick
On Tuesday, November 25, 2008, at 05:59PM, "Christian Jaeger" christian@pflanze.mine.nu wrote:
Christian Jaeger wrote:
Your best bet (short of someone going to debug it for you) really is running Gambit under gdb and see where it crashes. Just run "gdb gsc" and from there load your program as usual (assuming you're using, or know how to use, |compile-file| and |load| for your programs), or "gdb yourlinkedprogram" or "gdb gsi-script" or whatever. Then "run eventualprogramarguments" then "backtrace" when it crashed.
PS. I once wrote a script named "with-gdb-backtrace-to" which makes running apps under gdb trivial, I've now put it up here:
http://repo.or.cz/w/with-gdb-backtrace-to.git?a=blob_plain;f=with-gdb-backtr... http://repo.or.cz/w/with-gdb-backtrace-to.git
Christian.
Afficher les réponses par date
To try to find the culprit in the Termite failings.
---
Since you got:
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x01c03ffc 0x003058c5 in ___H_base_2d_exception_2d_handler (___ps=0x4a1880) at _thread.c:27164 27164 ___JUMP_CONTINUATION_CAPTURE1(___JUMPNOTSAFE) (gdb) bt #0 0x003058c5 in ___H_base_2d_exception_2d_handler (___ps=0x4a1880) at _thread.c:27164 #1 0x0000906f in ___call (nargs=0, proc=3701041, stack_marker=7340973) at setup.c:1819 (gdb)
you can find out from _thread.c by scrolling up from line 27164 that it's the ___H__23__23_continuation_2d_capture_2d_aux procedure which is failing, which is the compiled version of ##continuation-capture-aux. Since it fails in an unsafe jump, I'd expect that it's been called with something different than a procedure (or maybe a procedure of a wrong argument count, not sure here). (Since it tries to access an address far off zero, I guess the given object is not an #f value or small fixnum but rather an allocated object of a wrong type.) This patch adds type checks, so instead of segfaulting you should now get an exception. (I realize that I'm not using ##not and ##pair? but it seems to work this way anyway. I'm hoping that the not interrupts-enabled isn't being disturbed by the potential error call though; and worse, *if* an exception happens, the code is interrupted for sure, but I don't see why it should be a problem here.)
I haven't tried your program as I don't have Termite installed in my current Gambit, and moreover, it wouldn't be your version of Termite anyway. (And I don't have time either..)
lib/_thread.scm | 41 +++++++++++++++++++++++------------------ 1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/lib/_thread.scm b/lib/_thread.scm index d228dde..2caa6be 100644 --- a/lib/_thread.scm +++ b/lib/_thread.scm @@ -2764,24 +2764,29 @@ (##continuation? obj))
(define-prim (##continuation-capture-aux receiver lift1 lift2 lift3 others) - (##declare (not interrupts-enabled)) - (cond ((##eq? lift1 (macro-absent-obj)) - (##continuation-capture receiver)) - ((##eq? lift2 (macro-absent-obj)) - (##continuation-capture receiver lift1)) - ((##eq? lift3 (macro-absent-obj)) - (##continuation-capture receiver lift1 lift2)) - ((##null? others) - (##continuation-capture receiver lift1 lift2 lift3)) - (else - (let ((lifts - (##cons lift1 - (##cons lift2 - (##cons lift3 - others))))) - (##continuation-capture - (lambda (cont) - (##apply receiver (##cons cont lifts)))))))) + (if (not (##procedure? receiver)) + (error "##continuation-capture-aux: got non-procedure receiver:" receiver)) + (let () + (##declare (not interrupts-enabled)) + (cond ((##eq? lift1 (macro-absent-obj)) + (##continuation-capture receiver)) + ((##eq? lift2 (macro-absent-obj)) + (##continuation-capture receiver lift1)) + ((##eq? lift3 (macro-absent-obj)) + (##continuation-capture receiver lift1 lift2)) + ((##null? others) + (##continuation-capture receiver lift1 lift2 lift3)) + (else + (if (not (pair? others)) + (error "##continuation-capture-aux: not a list:" others)) + (let ((lifts + (##cons lift1 + (##cons lift2 + (##cons lift3 + others))))) + (##continuation-capture + (lambda (cont) + (##apply receiver (##cons cont lifts)))))))))
(define-prim (##continuation-capture receiver
Christian Jaeger wrote:
To try to find the culprit in the Termite failings.
Since you got:
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x01c03ffc 0x003058c5 in ___H_base_2d_exception_2d_handler (___ps=0x4a1880) at _thread.c:27164
PS. that the thing happens in base-exception-handler which is from Termite, makes me wonder whether Termite's exception handler is problematic, maybe in the case of an out of memory situation (like out of memory -> exception -> handler tries to do something which tries to throw a memory exception). Again, no time for digging, and in any case Marc will know better.
Christian.