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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.160.131 with SMTP id xk3mr15759761pab.17.1469818131160; Fri, 29 Jul 2016 11:48:51 -0700 (PDT) X-Received: by 10.157.14.230 with SMTP id 93mr2846371otj.17.1469818131118; Fri, 29 Jul 2016 11:48:51 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no5786187ith.0!news-out.google.com!d130ni18477ith.0!nntp.google.com!f6no5786184ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 29 Jul 2016 11:48:50 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.164.26.95; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 67.164.26.95 References: <3e02dbb0-69e3-429b-b8c5-d4762dbeb187@googlegroups.com> <66240de6-d3a8-458d-9eb9-1214f790831c@googlegroups.com> <22f2e37f-dc90-42ce-a6d3-42f0a471c4d6@googlegroups.com> <6178bf6c-6125-43b2-86c4-aeb08be48442@googlegroups.com> <273d77a5-55a6-4de6-abbe-93bb61ecfdc3@googlegroups.com> <4bd0a4ff-8262-41ee-bb5c-23672206a59a@googlegroups.com> <8a97f7ff-7fda-480b-9f6e-68a4f2995b83@googlegroups.com> <26fc8fd2-f81b-45f6-a584-e8558239eae0@googlegroups.com> <1114393d-a298-4b49-bae8-43ded7879887@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <92ae9e23-f254-41af-be05-d77c96754dd4@googlegroups.com> Subject: Re: Exception traceback when using TDM-GCC 5.1.0-3 From: Anh Vo Injection-Date: Fri, 29 Jul 2016 18:48:51 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31223 Date: 2016-07-29T11:48:50-07:00 List-Id: On Friday, July 29, 2016 at 8:57:44 AM UTC-7, Anh Vo wrote: > On Thursday, July 28, 2016 at 1:34:12 PM UTC-7, ahlan.m...@gmail.com wrot= e: > > On Thursday, 28 July 2016 18:16:14 UTC+2, Anh Vo wrote: > > > On Thursday, July 28, 2016 at 9:00:16 AM UTC-7, ahlan.m...@gmail.com = wrote: > > > > On Thursday, 28 July 2016 17:44:32 UTC+2, Anh Vo wrote: > > > > > On Thursday, July 28, 2016 at 7:48:17 AM UTC-7, Anh Vo wrote: > > > > > > On Wednesday, July 27, 2016 at 11:07:02 PM UTC-7, ahlan.m...@gm= ail.com wrote: > > > > > > > > =20 > > > > > > > > The exception is captured captured and handled in the excep= tion handler. In addition, the traceback information is extracted as shown = below. > > > > > > > >=20 > > > > > > > > --... > > > > > > > > exception=20 > > > > > > > > when Error : others =3D> =20 > > > > > > > > Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback(E= rror)); > > > > > > > > --... > > > > > > >=20 > > > > > > > Dear Anh, > > > > > > >=20 > > > > > > > Yes this is how I catch exceptions and display them symbolica= lly. > > > > > > > My current problem is that although I get some kind of traceb= ack, it isn't complete. > > > > > > > I only get two of the expected eight traceback addresses. > > > > > > > The two I do get have very high addresses and it seems normal= that these > > > > > > > cannot be resolved symbolically - hence they are displayed as= "??" by both > > > > > > > Gnat.Traceback.Symbolic.Symbolic_Traceback and addr2line > > > > > >=20 > > > > > > Try Simon's code with my modification shown below to see what I= get complete traceback. By the way, it work on my PC. > > > > > >=20 > > > > > > with Ada.Exceptions; use Ada.Exceptions; > > > > > > with Ada.Text_Io; use Ada.Text_Io; > > > > > > with GNAT.Traceback.Symbolic; > > > > > > procedure CE is > > > > > > procedure Raiser (N : Positive) is > > > > > > begin > > > > > > Raiser (N - 1); > > > > > > end Raiser; > > > > > > begin > > > > > > Raiser (5); > > > > > > exception > > > > > > when Error : others =3D> > > > > > > Put_Line ("Houston we have a problem: " & Exception_Infor= mation(Error)); > > > > > > Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback(Erro= r)); > > > > > > end Ce;=20 > > > > > >=20 > > > > > > AV > > > > >=20 > > > > > Sorry, what I meant was "Try Simon's code with my modification sh= own below to see if you get complete traceback. By the way, it worked on my= PC." > > > >=20 > > > > Dear Anh, > > > >=20 > > > > Yes I appreciate that.. > > > > This is what I always try to do - and it works with GPL but not wit= h TDM. > > > > But then nor does Addr2line so something is not quite right. > > > =20 > > > I share your frustration since I was in a similar situation before. T= hus, I have a suggestion. Use a PC having no GNAT nor TDM-GCC installed bef= ore. Install TDM-GCC and try it one more time. By the way, use command line= "gnatmake -f -g ce.adb -bargs -E" first. If you do not have another PC, un= install GNAT-GPL and TDM-GCC completely before reinstall TDM-GCC. > > >=20 > > > Anh Vo > >=20 > > Dear Anh, > > Although it made no real sense, I did as you suggested and much to my s= urprise I now get a traceback when I use gnatmake that when fed to Addr2lin= e returns the traceback that Simon has.=20 > > i.e. Address within CE.adb > > At least this is useful. > > However trying to convert this into a symbolic traceback using GNAT.Tra= ceback.Symbolic.Symbolic_Traceback(Error) > > merely produces eight lines of output - each line with the hexadecimal = traceback address. > > i.e. GNAT.Traceback.Symbolic.Symbolic_Traceback isn't working. > > Does it work for you? >=20 > Yes, it does work as expected. Here are the results I got. >=20 > Houston we have a problem: Exception name: CONSTRAINT_ERROR > Message: ce.adb:7 range check failed > Call stack traceback locations: > 0x40198b 0x40199b 0x40199b 0x40199b 0x40199b 0x4019bb 0x40194f 0x4013db 0= x75883388 0x77949900 0x779498d3 >=20 > [C:\Ada\Test\ce.exe] > 0x0040198B ce.raiser at ce.adb:7 > 0x0040199B ce.raiser at ce.adb:7 > 0x0040199B ce.raiser at ce.adb:7 > 0x0040199B ce.raiser at ce.adb:7 > 0x0040199B ce.raiser at ce.adb:7 > 0x004019BB ce at ce.adb:10 > 0x0040194F main at b~ce.adb:221 > 0x004013DB .tmainCRTStartup at crtexe.c:332 >=20 > [C:\Windows\syswow64\kernel32.dll] > [C:\Windows\SysWOW64\ntdll.dll] =20 MIG, My apology for crewing up. The gnatmake I invoked was part of GNAT-GPL. Aft= er correcting it on my PC at home, I got same results that you did, 9 Hex a= ddresses without traceback location. Anh Vo