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,d202b19275ae293 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news2.google.com!proxad.net!usenet-fr.net!news.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: Re: gnat: symbolic traceback on exceptions Date: Mon, 23 May 2005 17:23:12 +0200 Organization: Cuivre, Argent, Or Message-ID: References: <4291b4ed@news.upm.es> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: melchior.cuivre.fr.eu.org 1116861822 64933 212.85.156.195 (23 May 2005 15:23:42 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 23 May 2005 15:23:42 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: Manuel Collado Return-Path: In-Reply-To: <4291b4ed@news.upm.es> X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new at spray.net 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:11126 Date: 2005-05-23T17:23:12+02:00 2005-05-23 kl. 12.48 skrev Manuel Collado: > > ..> gnatmake -g main_program -bargs -E This is a requirement below as well > Or can it be programmatically generated, by explicitly invoking the=20 > message generation from the main program? Something like: > > procedure main_program is > begin > ... > exception > when others =3D> Trace_Exception; > end main_program; > > Where Trace_Exception is a general trace routine that uses gnat=20 > specific features and library routines. (which ones?) Not compiled, not tested, but should work You could put it in a separate package if you like. /Bj=F6rn ----------- with Ada.Exceptions; with Text_Io; use Text_Io; with Gnat.Traceback; procedure A_Test is A : String (1..1); procedure Tracebackinfo(E : Ada.Exceptions.Exception_Occurrence) is Last_Exception_Name : constant String :=3D=20 Ada.Exceptions.Exception_Name(E); Last_Exception_Messsage : constant String:=3D=20 Ada.Exceptions.Exception_Message(E); Last_Exception_Info : constant String:=3D=20 Ada.Exceptions.Exception_Information(E); begin Put("Exception raised : "); Put_Line(Last_Exception_Name); New_Line; Put_Line("Message : " & Last_Exception_Messsage); Put_Line(Last_Exception_Info); Put_Line("..................................................."); New_Line; Put_Line("Hex Subprogram name and file"); Put_Line("----- ------------------------"); Put_Line(Gnat.Traceback.Symbolic.Symbolic_Traceback(E)); Put_Line("-------------------------------------------------"); end Tracebackinfo; begin A :=3D "Hello, this raises Constraint_Error"; exception when E: others =3D> Tracebackinfo(E); end A_Test; Bj=F6rn Lundin bnl at spray dot se