[M3devel] NT386GNU status/fishing for guesses..
Jay
jayk123 at hotmail.com
Sun Feb 17 10:57:15 CET 2008
No need for a change in platform-independent code now.
My question was sort of "can anyone else try this out, I'm lazy".
But I looked up the definition of dup/dup2 and decided Cygwin wasn't doing anything wrong, looked at the strace, saw we were closing 0, started some RTIO... and if IsDebuggerPresent, DebugBreak and finally realized of course what was happening. (the debugging options are really not good. I couldn't even see the globals in gdb, neither of the obvious names worked...I was doing a little debugging in cdb as well and found a crashing bug in it, very very very unusual)
Writing a struct checker should actually be pretty easy.
The trick is probably mainly to limit the dependencies so it can work when much of the system is broken, or to use a cross strategy if possible..it helps that NT386 supports two sort of platforms/targets/configurations, so you can cross with a smaller context switch. :)
I'm not sure how to get field offsets in Modula-3 but if you get as far as having the compiler working, it can generate C with assertions as to sizes and offsets.
The compiler's dependency on stat is "the problem".
Again I like that idea of wrapping C in C, to expose a portable interface.Of course, it's inefficient. The direct exporting of C interfaces, when they are /correct/ is pretty efficient.
NT386GNU should be just about "self hosting" now -- able to build a "min" distribution and then "upgrade".
Small hacks in pylib.py needed that might break Win32, no big deal, it's "just the scripts". :)
Next steps will be:
a) consider changing the "naming conventions"
it's still foo.lib and not foo.a, foo.dll and not foo.so.
b) see if X Windows works (stuff builds)
c) the small set and bitmap bugs (running the tests!)
I do have one more commit to enable stuff, a small one, where the Slash is determine at runtime in slightly more code.
SL is already determined at runtime, but M3Path maps naming convensions (foo.lib vs. libfoo.a, foo.dll vs. foo.so) to also determine slashes. It might even work if they were escaped, but what I have is a good solution.
(if I figure I can ramble here, since I'm on topic. :) )
- Jay
> Date: Sun, 17 Feb 2008 10:30:01 +0100> From: wagner at elegosoft.com> To: m3devel at elegosoft.com> Subject: Re: [M3devel] NT386GNU status/fishing for guesses..> > Quoting Jay <jayk123 at hotmail.com>:> > > Nevermind, of course, I should have known, even though I'm working > > on fixing the stat struct (probably to blame for files always being > > out of date) and thought I might have it right, I should have known, > > I have it too small and the next variable is getting overwritten, > > causing us to close(0)..> > Yes, the C interfaces are the place where ports are most likely to> be broken. There are no checks there; it's completely unsafe.> I wonder if one could write a checker that compares the sizes of> the most important structures in C and M3, but that would probably> not be trivial.> > > If I put in arbitrary large padding at the end, it grows enough to > > cover up the problem..now to get it right..> > null_fd and the entire struct stat need not be globals, just the dev > > field...of course optimize that and I would have a stack corruption > > instead, not sure it would have been harder or easier to figure > > out..I should have started at the bottom of the system and gotten > > all the headers right in the first place....sigh.> > Yes, it's always a good idea to get the base right at the start.> On the other hand, you will usually return there during ant porting,> regardless of your best efforts ;-)> > > VAR null_done := FALSE; null_stat: Ustat.struct_stat; null_fd: INTEGER;> >> > PROCEDURE IsDevNull(READONLY statbuf: Ustat.struct_stat): BOOLEAN > > RAISES {} = VAR result: INTEGER; BEGIN IF NOT null_done THEN > > null_done := TRUE; null_fd := Unix.open( > > M3toC.FlatTtoS("/dev/null"), Unix.O_RDONLY, Unix.Mrwrwrw); IF > > null_fd < 0 THEN RETURN FALSE END; RTIO.PutText("1 null_fd is " > > & Fmt.Int(null_fd) & "\n"); 3 result := Ustat.fstat(null_fd, > > ADR(null_stat)); RTIO.PutText("2 null_fd is " & > > Fmt.Int(null_fd) & "\n"); 0 EVAL Unix.close(null_fd); > > and then close 0 here oops IF result # 0 THEN null_fd := -1 END> > [Could you try to persuade your mailer to produce a readable text> form besides HTML? If not it looks like that :-(]> > Anyway, as your previous posting asked about a change in general POSIX> support files, I'd really advise you to try out such changes on at> least one other platform (e.g. Linux), however innocuous they may seem.> > Thanks for all the work,> > Olaf> -- > Olaf Wagner -- elego Software Solutions GmbH> Gustav-Meyer-Allee 25 / Gebäude 12, 13355 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>
_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080217/e0c147fe/attachment-0002.html>
More information about the M3devel
mailing list