This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to unexec: guile-hobbit-1.3.3 with current sources ?


>>>>> "Valentin" == Valentin Kamyshenko <val@kamysh.materials.kiev.ua> writes:
Valentin> # tguile ERROR: In procedure apply: ERROR: Wrong type
Valentin> argument in position 1: %S

This looks as (but need not be) a missing symbol. 

This is the error you got when you are compiling some code:

        ... (foo bar) ...

into the C code:

        ... scm_apply(GLOBAL(H_foo), GLOBAL(bar)) ...

(the details may vary) and foo is undefined in the sense that the
value of H_foo is the #<undefined> value.

A quick way to find these kinds of error is to start gdb, put a
breakpoint in scm_error and run the program (you need a couple of
continues in the beginning). When you hit the error you move up the
stack til you get to the offending apply. My guess is that you will
find that  *H_foo is the undefined value (which is 9588).

Below is a few handy macros for ~/.gdbinit to help you inspect scheme
values in gdb. 'dp' takes a C value and prints it in the guile process
as a scheme value.

# -*- sh -*- 
# Define a bunch of useful functions for debugging Guile.
# Add more as required.

set $SCM_UNDEFINED=9588
set $SCM_EOL=10612

define start5
run
continue 5
end

define start2
run
continue 2
end

define start1
disable 1
run
enable 1
continue
end

define dp
set $gp=gdb_print($arg0)
output gdb_output
echo \n
end
document dp
Executes (display $arg0) to stdout.
end

define xcar
set $last=((scm_cell*) $arg0)->car
print $last
end
document xcar
Print the CAR of $.
end

define xcdr
set $last=((scm_cell*) $arg0)->cdr
print $last
end
document xcdr
Print the CDR of $.
end

define xgccdr
set $last=~1L & ((scm_cell*) $arg0)->cdr
print $last
end
document xgccdr
Print the CDR of $.
end

define xacar
set $last=&(((scm_cell*) $arg0)->car)
print $last
end
document xacar
Print the address of the CAR of $.
end

define xacdr
set $last=&(((scm_cell*) $arg0)->cdr)
print $last
end
document xacdr
Print the address of the CDR of $.
end

define ximp
set $last=($ & 6) ? 1 : 0
print $last
end
document ximp
Print 1 if $ is immediate, 0 otherwise.
end

define xvarvcell
xcdr
end
document xvarvcell
Print variable cell of $.
end

define xvariablep
set $last=(((scm_cell*) $arg0)->car) == scm_tc16_variable
print $last
end
document xvariablep
Print 1 if $ is a variable, 0 otherwise
end

define xuchars
set $last=(unsigned char *) (((scm_cell*) $arg0)->cdr)
print $last
end
document xuchars
Print string slot of $.
end

set $NumIsyms = 16
set $BoolF = (((0 + $NumIsyms) << 9) + 0x174L)
set $BoolT = (((1 + $NumIsyms) << 9) + 0x174L)

define xboolp
set $last=($ == $BoolF) || ($ == $BoolT)
print $last
end
document xboolp
Print 1 if $ is a boolean, 0 otherwise.
end

define xvelts
set $last=(long *)((scm_cell*) $arg0)->cdr
print $last
end
document xvelts
Print the VELTS of $.
end

define xlength
set $last=(((unsigned long)((scm_cell*) $arg0)->car)>>8)
print $last
end
document xlength
Print the LENGTH of $.
end

define xncellp
set $last=((sizeof(scm_cell)-1) & (int)$arg0)
print $last
end
document xncellp
Is $ a not a cell?
end

define xcellp
set $last=!((sizeof(scm_cell)-1) & (int)$arg0)
print $last
end
document xcellp
Is $ a a cell?
end

define xchars
set $last=(char *)(((scm_cell*) $arg0)->cdr)
print $last
end
document xchars
The CHARS of $
end

define xslots
set $last=((long *)(*((long *)(char *)(((scm_cell*) $arg0)->cdr)-1)))
print $last
end
document xslots
The SLOTS of $
end

define xfunc
set $last=((long *)(*((long *)(char *)(((scm_cell*) $arg0)->cdr)-1))))[0]
print $last
end
document xfunc
The FUNC of $
end

define xprops
set $last=((long *)(*((long *)(char *)(((scm_cell*) $arg0)->cdr)-1))))[1]
print $last
end
document xprops
The PROPS of $
end

define xaprops
set $last=&(((long *)(*((long *)(char *)(((scm_cell*) $arg0)->cdr)-1)))[1])
print $last
end
document xprops
The PROPS of $
end

define xtyp3
set $last=(7 & (int)(((scm_cell*) $arg0)->car))
print $last
end
document xtyp3
Print the xtyp3 of $
end

define xtyp7
set $last=0x7f & (int)(((scm_cell*) $arg0)->car)
print $last
end
document xtyp7
Print the TYP7 of $
end

define xtyp7s
set $last=0x7d & (int)(((scm_cell*) $arg0)->car)
print $last
end
document xtyp7s
Print the TYP77s of $
end

define xtyp16
set $last=0xffff & (int)(((scm_cell*) $arg0)->car)
print $last
end
document xtyp16
Print the TYP16 of $
end

define xtyp16s
set $last=0xfeff & (int)(((scm_cell*) $arg0)->car)
print $last
end
document xtyp16s
Print the TYP16S of $
end

define xgctyp16
set $last=0xff7f & (int)(((scm_cell*) $arg0)->car)
print $last
end
document xgctyp16
Print the GCTYP16 of $
end



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]