Greetings! "Mike Thomas" <[EMAIL PROTECTED]> writes:
> Hi Camm. > > The long standing problem I face here is that GBC is not enabled in > o/main.c when the function malloc() is called to make space for a string > when raw_pre_gcl.exe is first started up during the build. (Either line > 201 or 206 causes the problem.) > > On Windows I have defined "malloc" to be "gcl_malloc" to stop GCL's > malloc being called by the C runtime before main() starts up (causing > the same GBC not enabled issue before main evn begins). > > Apparently on Linux GBC is not called during those early calls to GCL's > malloc so I suppose that either my configuration is returning values > which are wrong, or not able to be dealt with by the GCL runtime as it > stands, or Linux is using a different malloc to the one used on Windows > or some other problem exists. > > Here is some debugging output. Any comments would be appreciated as I > want to remove these problems ASAP (within currently unpredictable time > constraints). > > ================================================================ > > > (gdb) r > Starting program: c:\cvs\head\gcl/unixport/raw_pre_gcl.exe > > Breakpoint 2, gcl_malloc (size=5) at alloc.c:1569 > 1569 if (in_malloc) > (gdb) n > 1571 in_malloc=1; > (gdb) n > 1584 if (GBC_enable==0) { > (gdb) n > 1585 if ( initflag ==0) > (gdb) n > 1586 gcl_init_alloc(); > (gdb) n > > Breakpoint 3, gcl_init_alloc () at alloc.c:936 > 936 if (gcl_alloc_initialized) return; > (gdb) n > 961 malloc_list = Cnil; > (gdb) n > 962 enter_mark_origin(&malloc_list); > (gdb) n > 966 set_maxpage(); > (gdb) n > 985 INIT_ALLOC; > Here is the origin of the problem it seems. From what I can see, mingw is using the def from att.h, which calls sbrk(0) with some page rounding. Either this is not setting core_end above DBEGIN, or (more likely) something is wrong with the arithmetic in #define CORE_PAGES (((ufixnum)core_end-DBEGIN)>>PAGEWIDTH) BTW, PAGESIZE is always a power of 2 on the machines I work on, and indeed is defined (if memory serves) as (1<<PAGEWIDTH). I'm not sure if I follow the meaning of reserve vs. commit below. What is PAGEWIDTH? Is DBEGIN an unsigned fixnum? What is core_end here? Take care, and thank you as always!!!!! > > ;; NOTE Cam: allocate_heap() reserves heap but commits nothing. > ;; Apparently commits are done by sbrk() / alloc_heap(). > ;; allocate_heap() lives in "o/unexnt.c" > > allocate_heap: base 3000000, end 3d000000, reserved_heap_size 3a000000, > PAGESIZE 1000, MAXPAGE 40000, MAXCORE 42fff000, INIT_NRBDIV 9, > INIT_HOLEDIV 3, HOLEDIV 4 > > > (gdb) n > 988 holepage = CORE_PAGES/INIT_HOLEDIV; > (gdb) n > 994 new_holepage = CORE_PAGES/HOLEDIV; > (gdb) n > 995 nrbpage = CORE_PAGES/INIT_NRBDIV; > (gdb) n > 998 fprintf ( stderr, > > gcl_init_alloc: PAGESIZE 1000, MAXPAGE 40000, MAXCORE 42fff000, > CORE_PAGES 0, INIT_NRBDIV 9, INIT_HOLEDIV 3, HOLEDIV 4 > > > (gdb) n > 1011 alloc_page(-(holepage + nrbpage)); > (gdb) p holepage > $1 = 0 > (gdb) p new_holepage > $2 = 0 > (gdb) p nrbpage > No symbol "nrbpage" in current context. > (gdb) n > > Breakpoint 4, alloc_page (n=0) at alloc.c:105 > 105 e = heap_end; > (gdb) n > 106 if (n >= 0) { > (gdb) p e > $3 = 0x3000000 <Address 0x3000000 out of bounds> > (gdb) n > 107 if (n >= > (gdb) n > 112 holepage = new_holepage + n; > (gdb) n > 119 if(in_signal_handler) > (gdb) n > 125 hole_overrun=1; > (gdb) n > 126 GBC(t_relocatable); > (gdb) > > ======================================================= > > Cheers > > Mike Thomas. > > > _______________________________________________ > Gcl-devel mailing list > Gcl-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/gcl-devel > > > -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org http://lists.gnu.org/mailman/listinfo/gcl-devel