[M3devel] strange errors...

Mika Nystrom mika at async.caltech.edu
Thu Jul 5 14:48:46 CEST 2007


Hi Daniel,

Thanks for helping look into this.  Could you send me a gdb stack
trace or something along those lines of the segmentation violation?
It doesn't have to be m3gdb, normal gdb would do fine.

The PRS.t file isn't missing.  What you're seeing is ktok being run
with a CWD of /home/danielb/Desktop/v/cit_parse/LINUXLIBC6 , so
PRS.t is indeed "../src/PRS.t".

The reason the file is empty in the last example is that that's
what had been generated by the time the ktok program crashed.  That's
exactly what I get on my Mac, except the program crashes on an
illegal instruction, not a segfault.  Of course it works fine on
PM3, both Windows and Unix, and older versions of CM3...  I'm sure
there's some kind of bug in ktok, too.

     Mika



"Daniel Alejandro Benavides D." writes:
>Hi:
>I take the sources from the your web page and type
>make on the top of the directory v and end in this
>message:
>
>===> cit_parse
>--- building in LINUXLIBC6 ---
>
>ignoring override("cit_parse",
>"/home/danielb/Desktop/v")
>
>/home/danielb/Desktop/v/parserlib/ktok/LINUXLIBC6/tok
>../src/PRS.t -o PRSTok.i3
>/home/danielb/Desktop/v/parserlib/ktok/LINUXLIBC6/tok
>../src/PRS.t -o PRSTok.i3
>
>
>***
>*** runtime error:
>***    Segmentation violation - possible attempt to
>dereference NIL
>***    pc = 0x4000b19f
>***
>
>"/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl",
>line 20: quake runtime error: exit 1536:
>/home/danielb/Desktop/v/parserlib/ktok/LINUXLIBC6/tok
>../src/PRS.t -o PRSTok.i3
>
>--procedure--  -line-  -file---
>exec               --  <builtin>
>_exec              20 
>/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl
>_xCons             37 
>/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl
>_tCons             81 
>/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl
>_tConsUn           82 
>/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl
>Token              85 
>/home/danielb/Desktop/v/parserlib/parserlib/src/parser.tmpl
>include_dir         3 
>/home/danielb/Desktop/v/cit_parse/src/m3makefile
>                    5 
>/home/danielb/Desktop/v/cit_parse/LINUXLIBC6/m3make.args
>
>Fatal Error: package build failed
>
>Well that was because of the lack of the file PRS.t
>
>Searching I noticed that the file is in
>v/cit_parse/src/PRS.t and made a copy on
>v/parserlib/ktok/src directory  
>Then try make again and but this time, get this:
>
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.t
>.
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.t
>.
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.l
>.
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.l
>.
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.y
>.
>cp
>/home/danielb/code/caltech-parser/v2/v/cit_parse/LINUXLIBC6/../src/CHP.y
>.
>/home/danielb/code/caltech-parser/v2/v/parserlib/kext/LINUXLIBC6/ext
>../src/CHPLexStd.e
>/home/danielb/code/caltech-parser/v2/v/parserlib/kext/LINUXLIBC6/ext
>../src/CHPLexStd.e
>new source -> compiling PRSTok.m3
>"../LINUXLIBC6/PRSTok.m3", line 1: syntax error:
>missing INTERFACE or MODULE keyword
>"../LINUXLIBC6/PRSTok.m3", line 1: unable to find
>interface (<missing id>)
>"../LINUXLIBC6/PRSTok.m3", line 1: warning: file name
>(PRSTok.m3) doesn't match module name (<missing id>)
>2 errors and 1 warning encountered
>new source -> compiling PRSTok.i3
>new source -> compiling PRSLex.i3
>new source -> compiling PRSLex.m3
>new source -> compiling PRSParse.i3
>new source -> compiling PRSParse.m3
>new source -> compiling PRSLexStd.i3
>new source -> compiling PRSLexStd.m3
>new source -> compiling PRSParseStd.i3
>new source -> compiling PRSParseStd.m3
>new source -> compiling CHPTok.i3
>new source -> compiling CHPTok.m3
>"../LINUXLIBC6/CHPTok.m3", line 36: warning:
>potentially unhandled exception:
>RTAllocator.OutOfMemory
>1 warning encountered
>new source -> compiling CHPLex.i3
>new source -> compiling CHPLex.m3
>new source -> compiling CHPParse.i3
>new source -> compiling CHPParse.m3
>new source -> compiling CHPLexStd.i3
>new source -> compiling CHPLexStd.m3
>new exporters -> recompiling PRSTok.i3
>compilation failed => not building library
>"libcit_parse.a"
>Fatal Error: package build failed
>
>danielb at danielb-desktop:~/code/caltech-parser/v2/v$ 
>
>
>It seems PRSTok.m3 does exist on
>v/cit_parse/LINUXLIBC6 but is an empty file.
>
>Maybe Im not doing the right steps?
>
>Thanks
>
>
>
>
>--- Mika Nystrom <mika at async.caltech.edu> wrote:
>
>> Hi again!
>> 
>> I was able to boot the CVS head of CM3 on my Mac
>> just fine now,
>> using the cm3.cfg you sent me.  I am still running
>> the old OS
>> (Panther, is it?) so I tried doing it the hard way
>> instead of using
>> your binaries, and I got something that works pretty
>> well.  Mentor
>> and Juno work, at least, and that's usually a good
>> indicator that
>> one is on the right track...
>> 
>> But (of course there's a "but"), I am still falling
>> down on my very
>> first reported bug, namely this local ktok program. 
>> I still, after
>> all that you've done, find that it dies on an
>> illegal instruction
>> on the Macintosh (I am running 10.3 on a Powerbook).
>> 
>> The problem goes away if I use either @M3nogc or
>> @M3noincremental.
>> The gdb backtrace is not very helpful: it says the
>> program is
>> crashing somewhere in a text processing module,
>> creating an iterator
>> on a sorted table.
>> 
>> Sorry to do this but I am feeling a bit clueless, so
>> if you're
>> interested and have the time to look into it, I have
>> set up a minimal
>> test here:
>> 
>> http://www.async.caltech.edu/~mika/ktok_example.tgz
>> 
>> Unfortunately, ktok itself depends on a bunch of
>> packages.
>> 
>> To build this, set your CM3 environment variable to
>> anything (1
>> works) and just "make" (GNU make, please).  Set the
>> DEBUGLEVEL
>> environment variable to "10" for a bit more output
>> (not much).  The
>> very last step (compiling package cit_parse) fails
>> for me...
>> Specifically, the step is:
>> 
>> /Users/mika/t/parserlib/ktok/PPC_DARWIN/tok
>> ../src/PRS.t -o PRSTok.i3
>> WELCOME!
>> GOT TOKPARAMS!
>> GOT TOKENS
>> GOT SUBS!
>> "/Users/mika/t/parserlib/parserlib/src/parser.tmpl",
>> line 20: quake runtime error: exit 4:
>> /Users/mika/t/parserlib/ktok/PPC_DARWIN/tok
>> ../src/PRS.t -o PRSTok.i3
>> 
>> Looking a bit closer:
>> 
>> [lapdog:~/t/cit_parse/src] mika% gdb
>> /Users/mika/t/parserlib/ktok/PPC_DARWIN/tok 
>> GNU gdb 5.3-20030128 (Apple version gdb-330.1) (Fri
>> Jul 16 21:42:28 GMT 2004)
>> Copyright 2003 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General
>> Public License, and you are
>> welcome to change it and/or distribute copies of it
>> under certain conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show
>> warranty" for details.
>> This GDB was configured as "powerpc-apple-darwin".
>> Reading symbols for shared libraries .. done
>> (gdb) run  ../src/PRS.t -o PRSTok.i3
>> Starting program:
>> /Users/mika/t/parserlib/ktok/PPC_DARWIN/tok
>> ../src/PRS.t -o PRSTok.i3
>> Reading symbols for shared libraries . done
>> WELCOME!
>> GOT TOKPARAMS!
>> GOT TOKENS
>> GOT SUBS!
>> 
>> Program received signal EXC_BAD_INSTRUCTION, Illegal
>> instruction/operand.
>> 0x00b111c8 in ?? ()
>> (gdb) where
>> #0  0x00b111c8 in ?? ()
>> #1  0x000120e4 in TextSubs__Apply
>> (M3_CN69dV_self=0xb26434, M3_Bd56fi_src=0xb40be0) at
>> TextSubs.m3:64
>> #2  0x0005b15c in RTLinker__RunMainBody
>> (M3_DjPxE3_m=0xad190) at RTLinker.m3:399
>> #3  0x00059f20 in RTLinker__AddUnitI
>> (M3_DjPxE3_m=0xad190) at RTLinker.m3:113
>> #4  0x0005a01c in RTLinker__AddUnit
>> (M3_DjPxE5_b=0x3520) at RTLinker.m3:122
>> #5  0x00001ecc in main (argc=4, argv=0xbffffadc,
>> envp=0xbffffaf0) at _m3main.mc:4
>> (gdb) 
>> 
>> Also:
>> 
>> PROCEDURE Apply(self: T; src: TEXT): TEXT =
>>   VAR
>>     wr := TextWr.New();
>>     c: CHAR;
>>     ind, pos, lastFlushed: INTEGER := 0;
>>     textLen := Text.Length(src);
>>     iter: SortedTextTextTbl.Iterator;
>>     original, replacement: TEXT;
>>     key, prefix: TEXT;
>>   PROCEDURE Flush() =
>>     BEGIN
>>       Wr.PutText(wr, Text.Sub(src, lastFlushed, pos
>> - lastFlushed));
>>     END Flush;
>>   BEGIN
>>     WHILE pos < textLen DO
>>       c := Text.GetChar(src, pos);
>>       IF c IN self.starts THEN
>>         Debug.Out("analysing: " & Text.Sub(src,
>> pos), 100);
>>         iter := self.tbl.iterateOrdered();   (* line
>> 64 *)
>>         ind := pos;
>>         original := "";
>>         REPEAT
>>           INC(ind);
>>       ...
>> 
>> I am mystified as to why gdb would say that
>> RTLinker__RunMainBody
>> would be calling TextSubs__Apply.
>> 
>> With @M3nogc or @M3noincremental, all is well...
>> 
>> I will see if I can figure out more, but this
>> problem just doesn't
>> seem to want to go away.  To the best of my
>> knowledge, ktok doesn't
>> use any UNSAFE code (outside of whatever's in libm3
>> of course).
>> 
>>      Mika
>> 
>> Tony Hosking writes:
>> >Sounds like we really need some work done in this
>> area.  I very  
>> >rarely use the build scripts, since I bootstrap
>> manually from old  
>> >compilers to new compilers rather than use the
>> scripts.  I suggest  
>> >the following approach, which I hope you will try,
>> and then report  
>> >back on.
>> >
>> >Install the bootstrap compiler as you did
>> originally:
>> >
>> >> rm -rf /usr/local/cm3/*
>> >>
>> >> cd ~/cm3-cvs
>> >> mkdir boot
>> >> cd boot
>> >> tar xzvf
>> ../cm3-min-POSIX-FreeBSD4-d5.3.1-2005-10-05.tgz
>> >> ./cminstall
>> >
>> >Now you will have some kind of cm3 installed,
>> presumably in /usr/ 
>> >local/cm3/bin/cm3.
>> >
>> >Make sure you have a fresh CVS checkout in
>> directory cm3 (let's  
>> >assume this is in your home directory ~/cm3). 
>> Also, make sure you  
>> >have an up-to-date version of the CM3 backend
>> compiler cm3cg  
>> >installed by executing the following:
>> >
>> >STEP 0:
>> >
>> >export CM3=/usr/local/cm3/bin/cm3
>> >cd ~/cm3/m3-sys/m3cc
>> >$CM3
>> >$CM3 -ship
>> >
>> >You can skip this last step if you know your
>> backend compiler is up  
>> >to date.
>> >
>> >Now, let's build the new compiler from scratch
>> (this is the sequence  
>> >I use regularly to test changes to the run-time
>> system whenever I  
>> 
>=== message truncated ===
>
>
>
>       
>____________________________________________________________________________________
>¡Descubre una nueva forma de obtener respuestas a tus preguntas!
>Entra en Yahoo! Respuestas.
>http://es.answers.yahoo.com/info/welcome



More information about the M3devel mailing list