This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Deprecated scm_tag broken
- To: "Dale P. Smith" <dpsm at bigbird dot en dot com>
- Subject: Re: Deprecated scm_tag broken
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Tue, 16 May 2000 09:49:32 +0200 (MEST)
- cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
On Mon, 15 May 100, Dale P. Smith wrote:
> In current cvs, if you #define SCM_DEBUG_DEPRECATED 1
> you get this error:
>
> gcc -g -O2 -Wall -Wmissing-prototypes -o .libs/guile .libs/guileS.o guile.o .libs/libguile.so -ldl -lm -lm -Wl,--export-dynamic -Wl,--rpath -Wl,/usr/local/lib
> .libs/libguile.so: undefined reference to `scm_tag'
> collect2: ld returned 1 exit status
>
> scm_tag is still used in libguile/gdbint.c in gdb_maybe_valid_type_p.
>
> Should this (unused? not_fully_implemented?) gdb interface be deprecated also?
> Or should scm_tag be not deprecated?
I took a look at gdb_maybe_valid_type_p. With some value that might be a
SCM value it performs the following test to figure out whether it actually
is a valid SCM value.
- if it is an immediate, return true.
- check if it is a pointer to a cell. This is a relatively exhaustive
test, since it really checks the pointer against all existing heap
segments that have been allocated so far.
- if it is a pointer to a cell, check the contents of the cell to contain
a valid scheme object. If it is a valid object, return true, else
false.
For the third part of the test scm_tag is used. I wonder, though, if this
test is not kind of redundant anyway: Every cell in one of the heap
segments should contain valid objects, except for the moment when the cell
is initially being filled with data. Even empty cells hold sensible
information, namely the scm_tc_free_cell tag.
Thus, if nobody objects I will apply the patch below. (An alternative
solution was to include all the type checks within gdb_maybe_valid_type_p,
but as stated before, the scm_tag check seems to be mostly redundant
anyway.)
However, this is obviously not an answer to Dale's question about whether
the gdb interface as a whole should be deprecated. I remember, though,
that there once were some clever macros for gdb debugging posted to the
list. Maybe people that use some tricks to get guile and gdb working
together more easily should post them such that I can at least write up
some documentation about it. (Yes, you got that right: Here's somebody
offering to write documentation if _you_ just provide the information.)
Best regards
Dirk
diff -u -r1.28 gdbint.c
--- gdbint.c 2000/04/21 14:16:30 1.28
+++ gdbint.c 2000/05/16 07:24:58
@@ -168,9 +168,7 @@
int
gdb_maybe_valid_type_p (SCM value)
{
- if (SCM_IMP (value) || scm_cellp (value))
- return (! SCM_EQ_P (scm_tag (value), SCM_MAKINUM (-1)));
- return 0;
+ return SCM_IMP (value) || scm_cellp (value);
}