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=0.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,THIS_AD autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d202b19275ae293 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: gautier_niouzes@hotmail.com Newsgroups: comp.lang.ada Subject: Re: gnat: symbolic traceback on exceptions Date: 25 May 2005 00:42:05 -0700 Organization: http://groups.google.com Message-ID: <1117006925.684308.317230@f14g2000cwb.googlegroups.com> References: <4291b4ed@news.upm.es> <42930a9b@news.upm.es> NNTP-Posting-Host: 213.173.163.2 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1117006930 19811 127.0.0.1 (25 May 2005 07:42:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 25 May 2005 07:42:10 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=213.173.163.2; posting-account=CZAoAgwAAAD9ntJQ85OlWL0_Q5EFdzP_ Xref: g2news1.google.com comp.lang.ada:11143 Date: 2005-05-25T00:42:05-07:00 List-Id: Manuel Collado: > > Did you try it with AdaGide with switch "Trace exception" set? Compile F3, > > run F4. > > No, I din't. But I've done it now without success. It seems that the > "Trace exceptions" option lets AdaGide to run the program through an > "AD" utility that interfaces with GDB. In my machine AD itself seems to > crash. Example: (...) This AD should disappear one day - I don't know if it even sometimes works... The solution to your problem ("the GNAT 3.13+ way") is, generically written: ------------------------------------------------------------------------------ -- File: TB_Wrap.ads -- Description: Trace-back wrapper for GNAT 3.13p+ (spec.) ------------------------------------------------------------------------------ generic with procedure My_main_procedure; procedure TB_Wrap; ------------------------------------------------------------------------------ -- File: TB_Wrap.adb -- Description: Trace-back wrapper for GNAT 3.13p+ (body) ------------------------------------------------------------------------------ with GNAT.Traceback.Symbolic, Ada.Exceptions, Ada.Text_IO; use Ada.Exceptions, Ada.Text_IO; procedure TB_Wrap is pragma Compiler_options("-g"); pragma Binder_options("-E"); begin My_main_procedure; exception when E: others => New_Line; Put_Line("---------------[ Unhandled exception ]------------"); Put_Line(" > Name of exception . . . . .: " & Ada.Exceptions.Exception_Name(E) ); Put_Line(" > Message for exception . . .: " & Ada.Exceptions.Exception_Message(E) ); Put_Line(" > Trace-back of call stack: " ); Put_Line( GNAT.Traceback.Symbolic.Symbolic_Traceback(E) ); end TB_Wrap; ----------- with TB_Wrap, Test; procedure Test_TB_Wrap is new TB_Wrap(Test); ----------- Of course you can do it without the generic wrapper, just paste the exception part at the end of your main procedure. The switches mentioned in the above code correspond to the compiler switches "debug info" and "trace-back" in the "Debugging" group of AdaGIDE's "Project settings" -> "Debug/Release settings". HTH ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!