[M3devel] Ubuntu problems

Tony Hosking hosking at cs.purdue.edu
Sun Dec 16 17:35:40 CET 2007


There are two places where setjmp/longjmp are used: user-level  
threading and exception handling.  On Windows, they are only used for  
exception handling since we rely on system threads.  On Solaris and  
Alpha/OSF they are not used for exception handling since those  
targets have stack unwinding support.  Converting user-level  
threading to use setcontext/getcontext should be relatively  
straightforward, based on the model already implemented for Solaris  
which I converted to setcontext/getcontext many years ago.

On Dec 16, 2007, at 12:33 AM, Jay wrote:

> http://opengrok.netbsd.org/source/search?q=&defs=setjmp
> http://opengrok.netbsd.org/source/search?q=&defs=longjmp
>
> oh -- hopefully the existing sizes are correct for this code, else  
> an interface break, not that m3 seems to mind binary compatibility  
> breaks and all or stick version numbers in places, though maybe  
> there are runtime checks for binary compat, at least for higher  
> levels.
>
> On Windows, setjmp/longjmp optionally interact "correctly" with  
> exception handling -- running __finally blocks and C++ destructors.
> I wonder if the same is true for gcc?
> (At some I'd really like to switch NT386 to not use setjmp/longjmp  
> or TlsGetValue/TlsSetValue for this stuff.. after 64bit integer  
> support...)
>
>  - Jay
>
>
> > From: hosking at cs.purdue.edu
> > Date: Sat, 15 Dec 2007 21:40:19 -0500
> > To: jay.krell at cornell.edu
> > CC: m3devel at elegosoft.com; mika at camembert.async.caltech.edu
> > Subject: Re: [M3devel] Ubuntu problems
> >
> > It may be slightly trickier than that, since appropriately sized
> > jmpbuf/ucontext needs to be declared.
> >
> > On Dec 15, 2007, at 9:14 PM, Jay wrote:
> >
> > > Maybe time to grab a BSD setjmp/longjmp or getcontext/setcontext,
> > > rename by prepending with m3_, and be done with it??
> > > e.g.
> > > http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/arch/i386/sys/
> > > getcontext.S?rev=1.2&content-type=text/x-cvsweb-markup
> > > http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/arch/powerpc/sys/
> > > getcontext.S?rev=1.3&content-type=text/x-cvsweb-markup
> > >
> > > My goodness, none of FreeBSD, OpenBSD, NetBSD have web searchable
> > > CVS archives..
> > > better links later..
> > >
> > > Regarding upgrade.sh, well, on Windows upgrade.cmd works. :)
> > > They are all "just" wrappers around cd'ing and building, but
> > > perhaps not trivial.
> > >
> > > - Jay
> > >
> > >
> > > > Date: Sun, 16 Dec 2007 02:38:03 +0100
> > > > From: dabenavidesd at yahoo.es
> > > > To: mika at async.caltech.edu; m3devel at elegosoft.com
> > > > CC: mika at camembert.async.caltech.edu
> > > > Subject: Re: [M3devel] Ubuntu problems
> > > >
> > > > Hi Mika,
> > > > what are you seeing is the problem of libc
> > > > setjmp/longjmp issue that we maybe have to advise more
> > > > to cm3 users, and in general *m3 (dec-src,pm3,ezm3,and
> > > > cm3 too) users that () user level thread
> > > > implementation which is part of m3core is not working
> > > > at this moment, so until community can make a
> > > > functioning a new implementation, we will use only
> > > > PTHREAD implementation on most new Linux
> > > > distributions.
> > > > Of course this solves the problems you are noticing,
> > > > so my advise in order to this do not happen any more
> > > > is write a note on the Download Area and maybe also in
> > > > (like a note in the Known issues), www.modula3.org
> > > > (If you allow me, I can do it)
> > > >
> > > > The most common case I know a (not very recent) of
> > > > distribution that works with user level implementation
> > > > that I use is Ubuntu Dapper 6.06, the libray is 2.3.6
> > > > http://packages.ubuntu.com/dapper/libdevel/libc6-dev
> > > > The next version of Ubuntu breaks when the Juno
> > > > package is compiling (pkl-fonts program executes), the
> > > > library libc6 is
> > > > http://packages.ubuntu.com/edgy/libdevel/libc6-dev.
> > > >
> > > > So for 5.4 sources use use the next CM3 variable
> > > > export CM3="/usr/local/cm3/bin/cm3 -DPTHREAD"
> > > >
> > > > This enable the system level thread implementation in
> > > > a earlier version of it (of cvs), but in the first
> > > > step bootstrap compiler you will ran in same problems
> > > > (in Edgy I got breack when running pkl-fonts, but
> > > > after that break you can re-compile it all well with
> > > > no problems, after you have build the new m3core).
> > > > If you can update the sources with the most recent (in
> > > > a personal opinion, stable version) would be better,
> > > > but here I would like to know if the script upgrade.sh
> > > > can do that work, i have not use it.
> > > > For me the most easy way for me was use the
> > > > instruction given by Tony for the cvs version, from I
> > > > take his words and make a relatively simple
> > > > instructions.
> > > >
> > > > Thanks
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --- Mika Nystrom <mika at async.caltech.edu> wrote:
> > > >
> > > > > Hello Modula-3 people,
> > > > >
> > > > > I am trying to build things with CM3 on a relatively
> > > > > recent Ubuntu
> > > > > system (don't ask me why...) and I am running into a
> > > > > segfault that
> > > > > I haven't seen mentioned before. I have a feeling
> > > > > it has something
> > > > > to do with stack formats, but I'm not sure what to
> > > > > do next.
> > > > >
> > > > > I downloaded the cm3-5.4.0 binaries and started with
> > > > > that. The
> > > > > compiler in the binary distribution runs, but it
> > > > > appears to produce
> > > > > garbage. I first tried bootstrapping but it crashes
> > > > > the moment it
> > > > > tries to execute something it has compiled itself.
> > > > > So then I tried
> > > > > hello, world, with the same results...
> > > > >
> > > > > Here's the system identification:
> > > > >
> > > > > mika at edwards:~/test/src$ uname -a
> > > > > Linux edwards 2.6.20-16-386 #2 Sun Sep 23 19:47:10
> > > > > UTC 2007 i686 GNU/Linux
> > > > >
> > > > > I made a "hello, world" program as follows:
> > > > >
> > > > > MODULE Main;
> > > > > IMPORT IO;
> > > > >
> > > > > BEGIN IO.Put("Hello, world!\n") END Main.
> > > > >
> > > > > Compiled with cm3 directly from the distributed
> > > > > cm3-5.4.0 for
> > > > > LINUXLIBC6 and I get a crash in CsetjmpASM.s (as far
> > > > > as I can tell).
> > > > > The last unclobbered stack I seem to be able to get
> > > > > in m3gdb is
> > > > > this:
> > > > >
> > > > > Breakpoint 5, 0xb75e5fb4 in _setjmp () at
> > > > > ../src/C/LINUXLIBC6/CsetjmpASM.s:31
> > > > > 31 in ../src/C/LINUXLIBC6/CsetjmpASM.s
> > > > > (m3gdb) where
> > > > > #0 0xb75e5fb4 in _setjmp () at
> > > > > ../src/C/LINUXLIBC6/CsetjmpASM.s:31
> > > > > #1 0xb75dbd51 in RTThread__Transfer
> > > > > (from=0xbfe28530, to=0xbfe28530) at
> > > > > ../src/runtime/LINUXLIBC6/RTThreadC.c:14
> > > > > #2 0xb75dbaed in FlushStackCache () at
> > > > > RTThread.m3:65
> > > > > #3 0xb75e27c9 in DetermineContext (oldSP=Invalid
> > > > > C/C++ type code 35 in symbol table.
> > > > > ) at ThreadPosix.m3:1101
> > > > > #4 0xb75e270d in InitTopContext (c=Invalid C/C++
> > > > > type code 30 in symbol table.
> > > > > ) at ThreadPosix.m3:1076
> > > > > #5 0xb75e4325 in Init () at ThreadPosix.m3:1498
> > > > > #6 0xb75c9592 in InitRuntime (p_argc=Invalid C/C++
> > > > > type code 39 in symbol table.
> > > > > ) at RTLinker.m3:59
> > > > > #7 0x08048861 in main (argc=1, argv=0xbfe28824,
> > > > > envp=0xbfe2882c) at _m3main.mc:3
> > > > > (m3gdb) cont
> > > > > Continuing.
> > > > >
> > > > > Program received signal SIGSEGV, Segmentation fault.
> > > > > 0xa8dbaede in ?? ()
> > > > >
> > > > > s.sp was lately 16_b75af6b9, if that means anything
> > > > > at all.
> > > > >
> > > > > Oh yes, one more thing: setting LD_POINTER_GUARD to
> > > > > 0 before running
> > > > > the program has no effect on the crash.
> > > > >
> > > > > Any suggestions for how one might make progress on
> > > > > this?
> > > > >
> > > > > Mika
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > ______________________________________________
> > > > ¿Chef por primera vez?
> > > > Sé un mejor Cocinillas.
> > > > http://es.answers.yahoo.com/info/welcome
> > >
> > >
> > > Don't get caught with egg on your face. Play Chicktionary!  
> Check it
> > > out!
> >
>
>
> Share life as it happens with the new Windows Live. Share now!




More information about the M3devel mailing list