1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

fix some missed references when calling C functions

* gdbinit: Update to be a bit more useful.

* libguile/vm-i-system.c: Make sure that arguments to C procedures are
  visible on the stack so they get marked. Could be a source for the
  missed references.
This commit is contained in:
Andy Wingo 2008-09-30 22:50:48 +02:00
parent 999f1b26e7
commit 887ce75ae8
2 changed files with 94 additions and 88 deletions

12
gdbinit
View file

@ -99,13 +99,15 @@ define smobdescriptor
p scm_smobs[0xff & (((scm_t_bits)$arg0) >> 8)] p scm_smobs[0xff & (((scm_t_bits)$arg0) >> 8)]
end end
define vmstack define vmstackinit
set $vmsp=sp set $vmsp=sp
set $vmstack_base=stack_base set $vmstack_base=stack_base
set $vmfp=fp set $vmfp=fp
set $vmbp=bp set $vmbp=bp
set $vmframe=0 set $vmframe=0
while $vmsp > vp->stack_base end
define nextframe
set $orig_vmsp=$vmsp set $orig_vmsp=$vmsp
while $vmsp > $vmstack_base while $vmsp > $vmstack_base
output $orig_vmsp - $vmsp output $orig_vmsp - $vmsp
@ -184,5 +186,11 @@ define vmstack
set $vmstack_base=$vmfp+$vmbp->nargs+$vmbp->nlocs+4 set $vmstack_base=$vmfp+$vmbp->nargs+$vmbp->nlocs+4
set $vmframe=$vmframe+1 set $vmframe=$vmframe+1
newline newline
end
define vmstack
vmstackinit
while $vmsp > vp->stack_base
nextframe
end end
end end

View file

@ -558,12 +558,12 @@ VM_DEFINE_INSTRUCTION (call, "call", 1, -1, 1)
{ {
/* At this point, the stack contains the procedure and each one of its /* At this point, the stack contains the procedure and each one of its
arguments. */ arguments. */
SCM args;
POP_LIST (nargs); POP_LIST (nargs);
POP (args);
SYNC_REGISTER (); SYNC_REGISTER ();
*sp = scm_apply (x, args, SCM_EOL); /* keep args on stack so they are marked */
sp[-1] = scm_apply (x, sp[0], SCM_EOL);
/* FIXME what if SCM_VALUESP(*sp) */ /* FIXME what if SCM_VALUESP(*sp) */
DROP ();
NEXT; NEXT;
} }
/* /*
@ -729,11 +729,10 @@ VM_DEFINE_INSTRUCTION (goto_args, "goto/args", 1, -1, 1)
*/ */
if (!SCM_FALSEP (scm_procedure_p (x))) if (!SCM_FALSEP (scm_procedure_p (x)))
{ {
SCM args;
POP_LIST (nargs); POP_LIST (nargs);
POP (args);
SYNC_REGISTER (); SYNC_REGISTER ();
*sp = scm_apply (x, args, SCM_EOL); sp[-1] = scm_apply (x, sp[0], SCM_EOL);
DROP ();
/* FIXME what if SCM_VALUESP(*sp) */ /* FIXME what if SCM_VALUESP(*sp) */
goto vm_return; goto vm_return;
} }
@ -798,11 +797,10 @@ VM_DEFINE_INSTRUCTION (mv_call, "mv-call", 3, -1, 1)
{ {
/* At this point, the stack contains the procedure and each one of its /* At this point, the stack contains the procedure and each one of its
arguments. */ arguments. */
SCM args;
POP_LIST (nargs); POP_LIST (nargs);
POP (args);
SYNC_REGISTER (); SYNC_REGISTER ();
*sp = scm_apply (x, args, SCM_EOL); sp[-1] = scm_apply (x, sp[0], SCM_EOL);
DROP ();
if (SCM_VALUESP (*sp)) if (SCM_VALUESP (*sp))
{ {
SCM values, len; SCM values, len;