gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gcl-devel] HEAD and GBC on Windows.


From: Mike Thomas
Subject: RE: [Gcl-devel] HEAD and GBC on Windows.
Date: Mon, 19 Dec 2005 12:31:59 +1000

Hi Camm.

THE PAST
 
| Is it possible the endianness of your system is being 
| incorrectly determined by configure?  This is goeverned by 
| the LITTLE_END C macro.

Truly awful.  This bug must have existed for years.  May I suggest the 
following method of detecting endianness:

AC_C_BIGENDIAN(,AC_DEFINE(LITTLE_END),)
AC_SUBST(LITTLE_END)

Slightly more radically, we could remove the LITTLE_END macro entirely and 
substitute the automatically generated WORDS_BIGENDIAN macro in our HEAD source 
code.

We could also clean out all other non-standard endian references in 
configure.in and gclincl.h.

The first of the above suggested changes should probably also go into gcl 
2.6.8, although it is very tempting to leave well enough alone given the years 
of excellent service that particular bug has given us.


THE FUTURE

The next problem with HEAD on Windows occurs when is_marked_or_free() is passed 
a bad pointer during the first call to mark_stack_carefully().  In the run 
below, the macro for is_marked_or_free is replaced by an equivalent function.

I hope you'll have some other excellent insight while pondering the mess below.

Cheers

Mike Thomas.

====================================================================

(gdb) r c:/cvs/head/gcl/unixport/ -libdir c:/cvs/head/gcl/
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: c:\cvs\head\gcl\unixport/raw_pre_gcl.exe c:/cvs/head/gcl/unixp
ort/ -libdir c:/cvs/head/gcl/

Breakpoint 1, mark_stack_carefully (topv=0x539380, bottomv=0x539270, offset=0)
    at gbc.c:732
732       long *top = (long *) topv, *bottom = (long *) bottomv;
(gdb) bt
#0  mark_stack_carefully (topv=0x539380, bottomv=0x539270, offset=0)
    at gbc.c:732
#1  0x004482ed in mark_phase () at gbc.c:777
#2  0x00448e41 in GBC (t=t_relocatable) at gbc.c:1281
#3  0x004044e3 in alloc_page (n=1) at alloc.c:126
#4  0x0040515d in make_cons (a=0x3275000, d=0x4cd530) at alloc.c:467
#5  0x00425a00 in funcall (fun=0x3275018) at eval.c:330
#6  0x00425e0e in funcall_no_event (fun=0x32548f8) at eval.c:398
#7  0x004277d8 in eval (form=0x4cd530) at eval.c:1109
#8  0x00484b7a in Fprogn (body=0x3275068) at prog.c:248
#9  0x00427504 in eval (form=0x3275048) at eval.c:1054
#10 0x0049e9b4 in Feval_when (arg=0x3275058) at toplevel.c:157
#11 0x00427504 in eval (form=0x3275050) at eval.c:1054
#12 0x00428271 in ieval (x=0x32754e8) at eval.c:1299
#13 0x00430cfa in load (
    s=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.lsp")
    at file.d:1942
#14 0x004a51c7 in load1 (
    x=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.lsp")
    at sys_pre_gcl.c:44
#15 0x004a55ef in gcl_init_system (no_init=0x31f7500) at sys_pre_gcl.c:82
#16 0x00403b43 in siLinit_system () at main.c:868
#17 0x004277cb in eval (form=0x4cd530) at eval.c:1107
---Type <return> to continue, or q <return> to quit---
#18 0x00484b7a in Fprogn (body=0x3259210) at prog.c:248
#19 0x00427504 in eval (form=0x3259220) at eval.c:1054
#20 0x004333d6 in Lload () at file.d:2361
#21 0x004277cb in eval (form=0x4cd530) at eval.c:1107
#22 0x00427d3f in fLeval (x0=0x32595c0) at eval.c:1199
#23 0x0043dfba in c_apply_n1 (fn=0x427ce3 <fLeval>, x=0x5392f4, y=0x0, z=0x0)
    at funlink.c:364
#24 0x00444e4e in c_apply_n (fn=0x427ce3 <fLeval>, n=1, x=0x5392f4)
    at funlink.c:1127
#25 0x0045f390 in IapplyVector (fun=0x31f1c90, nargs=1, base=0x5392f4)
    at nfunlink.c:231
#26 0x00425497 in funcall (fun=0x31f1c90) at eval.c:194
#27 0x00425e0e in funcall_no_event (fun=0x31f1c90) at eval.c:398
#28 0x004277d8 in eval (form=0x4cd530) at eval.c:1109
#29 0x00484b7a in Fprogn (body=0x3248878) at prog.c:248
#30 0x0049ec89 in Flocally (body=0x3248878) at toplevel.c:192
#31 0x00427504 in eval (form=0x32488b8) at eval.c:1054
#32 0x0045c98d in Fmultiple_value_list (form=0x3248870) at multival.c:62
#33 0x00427504 in eval (form=0x32488c0) at eval.c:1054
#34 0x004197d7 in let_bind (body=0x32487d8, start=0x5392c4, end=0x5392d4)
    at bind.c:683
#35 0x00451bac in Flet (form=0x3248858) at let.c:78
#36 0x00427504 in eval (form=0x32488d0) at eval.c:1054
---Type <return> to continue, or q <return> to quit---
#37 0x00484b7a in Fprogn (body=0x3248730) at prog.c:248
#38 0x0041b29f in Fcatch (args=0x3248990) at catch.c:46
#39 0x00427504 in eval (form=0x3248998) at eval.c:1054
#40 0x00421450 in Fwhen (form=0x3248728) at conditional.c:149
#41 0x00427504 in eval (form=0x32489a0) at eval.c:1054
#42 0x0044f6cb in Floop (form=0x3248ac0) at iteration.c:51
#43 0x00427504 in eval (form=0x3248b00) at eval.c:1054
#44 0x00484b7a in Fprogn (body=0x32486b8) at prog.c:248
#45 0x00451bd5 in Flet (form=0x3248c48) at let.c:82
#46 0x00427504 in eval (form=0x3248d40) at eval.c:1054
#47 0x00425b55 in funcall (fun=0x32596a8) at eval.c:344
#48 0x00426cae in super_funcall (fun=0x32486a0) at eval.c:760
#49 0x00402d10 in main (argc=4, argv=0x822418, envp=0x8231b0) at main.c:411
#50 0x004011e7 in _end__ ()
#51 0x00401238 in mainCRTStartup ()
#52 0x7c816d4f in _libwsock32_a_iname ()
(gdb) l
727       long pageoffset;
728       unsigned long p;
729       object x;
730       struct typemanager *tm;
731       register long *j;
732       long *top = (long *) topv, *bottom = (long *) bottomv;
733
734       /* if either of these happens we are marking the C stack
735          and need to use a local */
736
(gdb) bt
#0  mark_stack_carefully (topv=0x539380, bottomv=0x539270, offset=0)
    at gbc.c:732
#1  0x004482ed in mark_phase () at gbc.c:777
#2  0x00448e41 in GBC (t=t_relocatable) at gbc.c:1281
#3  0x004044e3 in alloc_page (n=1) at alloc.c:126
#4  0x0040515d in make_cons (a=0x3275000, d=0x4cd530) at alloc.c:467
#5  0x00425a00 in funcall (fun=0x3275018) at eval.c:330
#6  0x00425e0e in funcall_no_event (fun=0x32548f8) at eval.c:398
#7  0x004277d8 in eval (form=0x4cd530) at eval.c:1109
#8  0x00484b7a in Fprogn (body=0x3275068) at prog.c:248
#9  0x00427504 in eval (form=0x3275048) at eval.c:1054
#10 0x0049e9b4 in Feval_when (arg=0x3275058) at toplevel.c:157
#11 0x00427504 in eval (form=0x3275050) at eval.c:1054
#12 0x00428271 in ieval (x=0x32754e8) at eval.c:1299
#13 0x00430cfa in load (
    s=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.lsp")
    at file.d:1942
#14 0x004a51c7 in load1 (
    x=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.lsp")
    at sys_pre_gcl.c:44
#15 0x004a55ef in gcl_init_system (no_init=0x31f7500) at sys_pre_gcl.c:82
#16 0x00403b43 in siLinit_system () at main.c:868
#17 0x004277cb in eval (form=0x4cd530) at eval.c:1107
---Type <return> to continue, or q <return> to quit---q
Quit (expect signal SIGINT when the program is resumed)
(gdb) n
737       if (top==0) top = c_stack_where;
(gdb) p top
$7 = (long int *) 0x539380
(gdb) p topv
$8 = (void *) 0x539380
(gdb) p bottom
$9 = (long int *) 0x539270
(gdb) p bottomv
$10 = (void *) 0x539270
(gdb) n
738       if (bottom==0) bottom= c_stack_where;
(gdb) n
744       if (offset)
(gdb) p offset
$11 = 0
(gdb) n
747       for (j=top ; j >= bottom ; j--) {
(gdb) n
748         if (VALID_DATA_ADDRESS_P(*j)
(gdb) n
750           pageoffset=((char *)*j - pagetochar(p));
(gdb) n
751           tm=tm_of((enum type) type_map[p]);
(gdb) n
752           x= (object)
(gdb) n
756           if ((pageoffset <  (tm->tm_size * tm->tm_nppage))
(gdb) n
758             mark_object(x);
(gdb) b is_marked_or_free
Breakpoint 3 at 0x446e69: file gbc.c, line 178.
(gdb) n

Breakpoint 3, is_marked_or_free (a_=0x3254908) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) n
179         fixnum t1 = (fixnum)(a_);
(gdb) n
180         fixnum t2 = IM_FIX_LIM;
(gdb) n
181         fixnum t3 = (((fixnum)(a_))&IM_FIX_LIM);
(gdb) n
183         if (is_imm_fixnum(c)) {
(gdb) p t1
$12 = 52775176
(gdb) p t2
$13 = 1073741824
(gdb) p t3
$14 = 0
(gdb) n
186             rv = a_->md.mf;
(gdb) n
188         return rv;
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x3254990) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x320bcf8) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x3259ae0) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x31fdc30) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x4cd530) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) n
179         fixnum t1 = (fixnum)(a_);
(gdb) n
180         fixnum t2 = IM_FIX_LIM;
(gdb) n
181         fixnum t3 = (((fixnum)(a_))&IM_FIX_LIM);
(gdb) n
183         if (is_imm_fixnum(c)) {
(gdb) p t1
$15 = 5035312
(gdb) p t2
$16 = 1073741824
(gdb) p t3
$17 = 0
(gdb) n
186             rv = a_->md.mf;
(gdb) n
188         return rv;
(gdb) p rv
$18 = 1
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0x3259ae8) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) c
Continuing.

Breakpoint 3, is_marked_or_free (a_=0xa0000001) at gbc.c:178
178         object c = Zcdr(a_);
(gdb) bt
#0  is_marked_or_free (a_=0xa0000001) at gbc.c:178
#1  0x004470f8 in mark_object (x=0xa0000001) at gbc.c:286
#2  0x00446fd0 in mark_cons (x=0x3259ae8) at gbc.c:242
#3  0x0044730d in mark_object (x=0x3259ae0) at gbc.c:351
#4  0x004471cb in mark_object (x=0x320bcf8) at gbc.c:313
#5  0x00446fd0 in mark_cons (x=0x3254990) at gbc.c:242
#6  0x00446fc0 in mark_cons (x=0x3254908) at gbc.c:239
#7  0x0044730d in mark_object (x=0x3254908) at gbc.c:351
#8  0x004482a3 in mark_stack_carefully (topv=0x539380, bottomv=0x539270,
    offset=0) at gbc.c:758
#9  0x004482ed in mark_phase () at gbc.c:777
#10 0x00448e41 in GBC (t=t_relocatable) at gbc.c:1281
#11 0x004044e3 in alloc_page (n=1) at alloc.c:126
#12 0x0040515d in make_cons (a=0x3275000, d=0x4cd530) at alloc.c:467
#13 0x00425a00 in funcall (fun=0x3275018) at eval.c:330
#14 0x00425e0e in funcall_no_event (fun=0x32548f8) at eval.c:398
#15 0x004277d8 in eval (form=0x4cd530) at eval.c:1109
#16 0x00484b7a in Fprogn (body=0x3275068) at prog.c:248
#17 0x00427504 in eval (form=0x3275048) at eval.c:1054
#18 0x0049e9b4 in Feval_when (arg=0x3275058) at toplevel.c:157
#19 0x00427504 in eval (form=0x3275050) at eval.c:1054
#20 0x00428271 in ieval (x=0x32754e8) at eval.c:1299
#21 0x00430cfa in load (
---Type <return> to continue, or q <return> to quit---q
s=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.Quit (expect signal SIGI
NT when the program is resumed)
) at file.d:1942
#22 0x004a51c7 in load1 (
    x=0x25d140 "c:/cvs/head/gcl/unixport/../lsp/gcl_predlib.lsp")
    at sys_pre_gcl.c:44
#23 0x004a55ef in gcl_init_system (no_init=0x31f7500) at sys_pre_gcl.c:82
#24 0x00403b43 in siLinit_system () at main.c:868
#25 0x004277cb in eval (form=0x4cd530) at eval.c:1107
#26 0x00484b7a in Fprogn (body=0x3259210) at prog.c:248
#27 0x00427504 in eval (form=0x3259220) at eval.c:1054
#28 0x004333d6 in Lload () at file.d:2361
#29 0x004277cb in eval (form=0x4cd530) at eval.c:1107
#30 0x00427d3f in fLeval (x0=0x32595c0) at eval.c:1199
#31 0x0043dfba in c_apply_n1 (fn=0x427ce3 <fLeval>, x=0x5392f4, y=0x0, z=0x0)
    at funlink.c:364
#32 0x00444e4e in c_apply_n (fn=0x427ce3 <fLeval>, n=1, x=0x5392f4)
    at funlink.c:1127
#33 0x0045f390 in IapplyVector (fun=0x31f1c90, nargs=1, base=0x5392f4)
    at nfunlink.c:231
#34 0x00425497 in funcall (fun=0x31f1c90) at eval.c:194
#35 0x00425e0e in funcall_no_event (fun=0x31f1c90) at eval.c:398
#36 0x004277d8 in eval (form=0x4cd530) at eval.c:1109
#37 0x00484b7a in Fprogn (body=0x3248878) at prog.c:248
#38 0x0049ec89 in Flocally (body=0x3248878) at toplevel.c:192
---Type <return> to continue, or q <return> to quit---
#39 0x00427504 in eval (form=0x32488b8) at eval.c:1054
#40 0x0045c98d in Fmultiple_value_list (form=0x3248870) at multival.c:62
#41 0x00427504 in eval (form=0x32488c0) at eval.c:1054
#42 0x004197d7 in let_bind (body=0x32487d8, start=0x5392c4, end=0x5392d4)
    at bind.c:683
#43 0x00451bac in Flet (form=0x3248858) at let.c:78
#44 0x00427504 in eval (form=0x32488d0) at eval.c:1054
#45 0x00484b7a in Fprogn (body=0x3248730) at prog.c:248
#46 0x0041b29f in Fcatch (args=0x3248990) at catch.c:46
#47 0x00427504 in eval (form=0x3248998) at eval.c:1054
#48 0x00421450 in Fwhen (form=0x3248728) at conditional.c:149
#49 0x00427504 in eval (form=0x32489a0) at eval.c:1054
#50 0x0044f6cb in Floop (form=0x3248ac0) at iteration.c:51
#51 0x00427504 in eval (form=0x3248b00) at eval.c:1054
#52 0x00484b7a in Fprogn (body=0x32486b8) at prog.c:248
#53 0x00451bd5 in Flet (form=0x3248c48) at let.c:82
#54 0x00427504 in eval (form=0x3248d40) at eval.c:1054
#55 0x00425b55 in funcall (fun=0x32596a8) at eval.c:344
#56 0x00426cae in super_funcall (fun=0x32486a0) at eval.c:760
#57 0x00402d10 in main (argc=4, argv=0x822418, envp=0x8231b0) at main.c:411
#58 0x004011e7 in _end__ ()
#59 0x00401238 in mainCRTStartup ()
#60 0x7c816d4f in _libwsock32_a_iname ()
(gdb) up 3
#3  0x0044730d in mark_object (x=0x3259ae0) at gbc.c:351
351         mark_cons(x);
(gdb) down
#2  0x00446fd0 in mark_cons (x=0x3259ae8) at gbc.c:242
242         mark_object(x->c.c_car);
(gdb) p x
$19 = 0x3259ae8
(gdb) p *x
$20 = {FIX = {e = 0, m = -1, f = 0, s = 0, z = 3, t = -43, w = 76,
    FIXVAL = -1610612735}, big = {e = 0, m = -1, f = 0, s = 0, z = 3, t = -43,
    w = 76, big_mpz_t = {_mp_alloc = -1610612735, _mp_size = 5035312,
      _mp_d = 0xa0000001}}, rat = {e = 0, m = -1, f = 0, s = 0, z = 3,
    t = -43, w = 76, rat_den = 0xa0000001, rat_num = 0x4cd530,
    pad = 0xa0000001}, SF = {e = 0, m = -1, f = 0, s = 0, z = 3, t = -43,
    w = 76, SFVAL = -1.0842023e-019}, LF = {e = 0, m = -1, f = 0, s = 0,
    z = 3, t = -43, w = 76, LFVAL = -1.4916695704734213e-154,
    pad = 0x3259af0}, cmp = {e = 0, m = -1, f = 0, s = 0, z = 3, t = -43,
    w = 76, cmp_real = 0xa0000001, cmp_imag = 0x4cd530, pad = 0xa0000001},
  ch = {e = 0, m = -1, f = 0, s = 0, z = 3, t = -43, w = 76, ch_code = 1,
    ch_font = 0 '\0', ch_bits = 160 'รก'}, s = {e = 0, m = -1, f = 0, s = 0,
    z = 3, t = -43, w = 76, s_sfdef = 0xa0000001, s_dbind = 0x4cd530,
    st_self = 0xa0000001 "\220\001=", st_fillp = 52796144,
    s_gfdef = 0x3259b30, s_plist = 0x4cd530, s_hpack = 0x3259b08,
    s_stype = -25840, s_mflag = 805, s_hash = 52476936}, p = {e = 0, m = -1,
    f = 0, s = 0, z = 3, t = -43, w = 76, p_name = 0xa0000001,
    p_nicknames = 0x4cd530, p_shadowings = 0xa0000001, p_uselist = 0x3259af0,
    p_usedbylist = 0x3259b30, p_internal = 0x4cd530, p_external = 0x3259b08,
    p_internal_size = 52796176, p_external_size = 52476936,
    p_internal_fp = 5035312, p_external_fp = 52419632, p_link = 0x3259b00,
    pad = 0x3259b20}, c = {c_cdr = 0x4cd532, c_car = 0xa0000001}, ht = {e = 0,
    m = -1, f = 0, s = 0, z = 3, t = -43, w = 76, ht_self = 0xa0000001,
---Type <return> to continue, or q <return> to quit---q
ht_rhsizQuit (expect signal SIGINT when the program is resumed)
(gdb) p x
$21 = 0x3259ae8
(gdb) p /x x->c.c_car
$22 = 0xa0000001
(gdb) p x->c.c_car
$23 = 0xa0000001
(gdb) p *(unsigned *) x
$24 = 5035314
(gdb) p x->d.t
$25 = -43
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x00446e6c in is_marked_or_free (a_=0xa0000001) at gbc.c:178
178         object c = Zcdr(a_);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]