Andy Wingo <wi...@pobox.com> writes: > Hi Mike, > > On Sun 13 Sep 2009 16:30, l...@gnu.org (Ludovic Courtès) writes: > >> Mike Gran <spk...@yahoo.com> writes: >> >>> With the default behavior of 1.9.x, REPL debug and backtrace are broken. >> >> Indeed, it looks like the VM frames are ignored. > > Hopefully by the next release, and certainly by the following one, this > will be fixed: by having everything on the VM stack. So yes it sucks > now, but it's because we have so many kinds of procedures and stacks > that it's tough to make a nice debugging interface.
Actually I think I just found and fixed one problem. From the time when a #<program> was a SMOB, really_make_boot_program in vm.c was still using SCM_SET_SMOB_FLAGS to set the SCM_F_PROGRAM_IS_BOOT flag - which meant that it was setting flag 1<<32 :-) which obviously was then missed by the SCM_PROGRAM_IS_BOOT calls in stacks.c. So now, with my test script ((lambda _ (car 1) 23)) I get a backtrace: n...@arudy:~/SW/Guile/git$ meta/guile --debug -s ../testcar.scm Backtrace: In ice-9/boot-9.scm: 1772: 0* [save-module-excursion #<program 9dc0630 at ice-9/boot-9.scm:1785:3 ()>] In unknown file: ?: {1}* [dynamic-wind #<program 9dc0620 at ice-9/boot-9.scm:1771:18 ()> ...] In ice-9/boot-9.scm: 935: 2* [load "../testcar.scm"] In unknown file: ?: 3* [with-fluid* #<fluid 9> #f #<program 9dc0600 at ice-9/boot-9.scm:935:4 ()>] In ice-9/boot-9.scm: 940: 4* [#<program 9dc0600 at ice-9/boot-9.scm:935:4 ()>] In unknown file: ?: 5* [load-compiled/vm "/home/neil/SW/Guile/git/cache/guile/ccache/1.9-0.D-LE-4/home/neil/SW/Guile/testcar.scm.go"] In ../testcar.scm: 2: 6* [#<program 9e3e4e0 at ../testcar.scm:0:1 _> 23] ERROR: In procedure vm-debug-engine: ERROR: Wrong type argument in position 1 (expecting pair): 1 I'll push the fix a bit later. (I also have fixes for the incorrect stack count warning.) But I notice that there is only ever one frame per VM. E.g. with code like (define (foo n) (let ((a 1)) (let ((b 2)) (string-append (* a b))))) (which deliberately passes an invalid arg to string-append), the interpreter backtrace would show the two `let' frames, whereas the VM backtrace doesn't. Is that intended, or something else to investigate? Regards, Neil