From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c96afc4bd5bda0f0,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: =?iso-8859-1?q?Bj=F6rn_Lundin?= Newsgroups: comp.lang.ada Subject: Gnat 3.4.2 tasking errorcodes windows Date: Mon, 17 Jan 2005 20:44:54 +0100 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: melchior.cuivre.fr.eu.org 1105991123 41214 212.85.156.195 (17 Jan 2005 19:45:23 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 17 Jan 2005 19:45:23 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: User-Agent: KMail/1.7.2 Content-Disposition: inline X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:7876 Date: 2005-01-17T20:44:54+01:00 Hello all! A couple of weeks I sent the mail below, but got no answers. Well,=20 I then tried to use gnat 3.4.2 from minGW, instead of 3.15.p, but I got he= =20 same results still. Besides, it it only me that misses libaddr2line, used t= o=20 print stacktraces? It was included in 3.15p, but now I cant find it :( Below is the last mail, and the sample code. Any pointers to what is happen= ing=20 are very appreciated.=20 /Bj=F6rn I'm writing a console socket application, with several tasks, and I run into som strange behaviour when tasks are involved. Below is output from a test program (also below). The first output is when the tasking part was comment ed out, the second output is from when tasking is part of the program. comp= ile d with gnat 3.15p on a w2k box. (just gnatmake socket_connect.adb) What I wonder is why I can get the correct errorcode by calling=20 WSAGetLasterror (which is what Gnat.Sockets.Thin.Socket Errno does, just=20 pragma import) when having no tasks, but not when having tasks. It gets even more strange (to me at least) when i realize that the associat ed error string to the exception has the correct error code in both cases. By looking in the sources I see, that gnat is using=20 Gnat.Sockets.Thin.Socket Errno to create that error-string.=20 Testing with Object Ada 7.2.2 (well basically the same) will get the=20 correct errorcode no matter of tasking or not regards Bj=F6n Lundin Without tasking =2D------------------------------------------- Startup sockets Get a socket Try to connect! GNAT.SOCKETS.SOCKET ERROR: [10061] Connection refused 10061 - Connection refused Resolve Exception - CONNECTION REFUSED With tasking =2D------------------------------------------- Task running, Execute! Startup sockets Get a socket Try to connect! GNAT.SOCKETS.SOCKET ERROR: [10061] Connection refused 0 - Unknown system error Resolve Exception - CONNECTION REFUSED =2D------------------------------------------------------------------------ =2D- with Text Io; with Gnat.Sockets; with Gnat.Sockets.Thin; with Ada.Exceptions; procedure Socket Connect is Socket : Gnat.Sockets.Socket Type; Address : Gnat.Sockets.Sock Addr Type; Error : Integer :=3D 0; -------------------------------------------------- task type Run Once is entry Execute; end Run Once; -------------------------------------------------- task body Run Once is begin select accept Execute do text io.put line("Task running, Execute!"); end Execute; or terminate; end select; end Run Once; -------------------------------------------------- begin declare TmpTask : Run Once; begin TmpTask.Execute; end; text io.put line("Startup sockets"); Gnat.Sockets.Initialize; text io.put line("Get a socket"); Gnat.Sockets.Create Socket (Socket); text io.put line("Try to connect!"); Address.Addr :=3D Gnat.Sockets.Inet Addr("127.0.0.1");=20 Address.Port :=3D 8000; Gnat.Sockets.Connect Socket (Socket, Address); text io.put line("Connected!"); text io.put line("Close socket!"); Gnat.Sockets.Close Socket (Socket); text io.put line("Shutdown sockets!"); Gnat.Sockets.Finalize; text io.put line("Done!"); exception when E: others =3D> Text IO.Put Line(Ada.Exceptions.Exception Name (E) & ": " &=20 Ada.Exceptions.Exception Message (E)); =20 Error :=3D Gnat.Sockets.Thin.Socket Errno; Text IO.Put Line(Integer'Image(Error) & " - " &=20 Gnat.Sockets.Thin.Socket Error Message (Error)); =20 Text IO.Put Line("Resolve Exception" & " - " &=20 Gnat.Sockets.Error Type'Image(Gnat.Sockets.Resolve Exception(E))); Gnat.Sockets.Finalize; end socket connect; =2D------------------------------------------------------------------------ =2D-