comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Drummond <brian@shapes.demon.co.uk>
Subject: Re: Re-write a file in Ada
Date: Tue, 19 Jan 2016 12:24:36 -0000 (UTC)
Date: 2016-01-19T12:24:36+00:00	[thread overview]
Message-ID: <n7l9u3$p95$1@dont-email.me> (raw)
In-Reply-To: 73c2bbe1-15fc-4c29-b500-fb0a637abd91@googlegroups.com

On Mon, 18 Jan 2016 07:05:55 -0800, gautier_niouzes wrote:

> Le lundi 11 janvier 2016 18:18:48 UTC+1, Brian Drummond a écrit :
> 
>> > raised ADA.IO_EXCEPTIONS.END_ERROR : a-tigeli.adb:96
>> 
>> In outline, when you see this sort of error, find the installation's
>> "Ada include directory" which contains the named file...
>> 
>> locate a-tigeli.adb
>> /usr/lib/gcc/x86_64-linux-gnu/4.9/rts-native/adainclude/a-tigeli.adb
...
>> Looks like we ran out of file somehow. From here on it's usually
>> straightforward.
> 
> Sure - but all that investigation effort brings nothing: the exception's
> name gives already this hint: the end of a file was reached. The fact
> that it raised somewhere in the run-time library is obvious and brings
> zero information for finding the bug: no indication is given about where
> the exception occurred in the program. 

Yes, that is true for End_Error specifically, (assuming you have already 
learned what "End_Error" means. Which may not be obvious to a beginner) 

Other exceptions - Constraint_Error, Storage_Error and so on have a much 
wider range of causes, then this process can be more helpful. I could 
have been clearer that I wanted to make a wider point.

For example, tracing "Constraint_Error" that way, once landed me in the 
Ada.Command_Line package, which made it immediately obvious I wasn't 
trapping command lines with missing arguments.

> It's a shame that GNAT doesn't
> switch on its trace-back by default, IMHO. The current setup is
> disturbing for beginners and cumbersome for people using GNAT for larger
> programs.

Agreed. Traceback would be very helpful. Because I can never remember 
how, I'll outline it here, partly in the hope of memorising it. From

https://gcc.gnu.org/onlinedocs/gnat_ugn/Non-Symbolic-Traceback.html#Non-
Symbolic-Traceback

To enable this feature you must use the `-E' gnatbind's option. 
(And compile with -g for debug information)
gnatmake -g main.adb -bargs -E

A similar point has been made for the "Ada compliant" checking flags, and 
while Gnat has been improved in this area, I think you still need to add 
some flags, giving

gnatmake -g -gnataoE -fstack-check main.adb -bargs -E

-- Brian


  reply	other threads:[~2016-01-19 12:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 15:55 Re-write a file in Ada comicfanzine
2016-01-07 13:02 ` comicfanzine
2016-01-08 20:35 ` comicfanzine
2016-01-09  9:50   ` Brian Drummond
2016-01-08 21:22 ` Randy Brukardt
2016-01-08 22:08   ` Anh Vo
2016-01-10 16:54 ` comicfanzine
2016-01-10 18:59   ` Björn Lundin
2016-01-11 17:16   ` Brian Drummond
2016-01-18 15:05     ` gautier_niouzes
2016-01-19 12:24       ` Brian Drummond [this message]
2016-01-19 16:52         ` gautier_niouzes
2016-01-21 12:26           ` Brian Drummond
2016-01-10 22:57 ` comicfanzine
2016-01-11  1:59   ` Anh Vo
2016-01-11 10:09   ` Björn Lundin
2016-01-18  0:22 ` comicfanzine
2016-01-18  9:50   ` AdaMagica
2016-01-18 17:27     ` Björn Lundin
2016-01-18 11:52   ` Brian Drummond
2016-01-18 17:30   ` Björn Lundin
2016-01-18 17:25 ` comicfanzine
2016-01-18 17:49   ` J-P. Rosen
2016-01-18 18:37   ` Simon Wright
2016-01-19 12:33   ` Brian Drummond
2016-01-19 14:40     ` Simon Wright
2016-01-21 12:31       ` Brian Drummond
2016-01-19 12:04 ` comicfanzine
2016-01-19 14:29   ` Anh Vo
2016-01-19 14:35     ` Simon Wright
2016-01-19 16:54       ` Jeffrey R. Carter
2016-01-19 17:32         ` Anh Vo
2016-01-19 16:53   ` Stephen Davies
2016-01-20  1:12 ` comicfanzine
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox