[M3devel] strange errors...

Olaf Wagner wagner at elegosoft.com
Wed Jul 4 17:32:12 CEST 2007


On Wed, July 4, 2007 2:10 pm, Mika Nystrom 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).

I cannot really tell you why there's a bad instruction in some of
the module initialization code, but the RT linker is executing all
the module bodies in correct order at the start of the program (at
least it tries to :). So probably TextSubs.Apply is called from
some module initialization code.

Have you tried to run the program with @M3tracelinker to get some
context to that call? It should print ouy all module names... This
_may_ be helpful.

Olaf
-- 
Olaf Wagner -- elego Software Solutions GmbH, Ohmstr. 9, 10179 Berlin, Germany
phone: +49 30 23 45 86 96  mobile: +49 177 2345 869  fax: +49 30 23 45 86 95
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194




More information about the M3devel mailing list