Re: new revision ada

From: Brian May (bam_at_snoopy.apana.org.au)
Date: 06/23/04


Date: Wed, 23 Jun 2004 14:31:27 +1000

There seem to be two proposed solutions for the problem of passing
information from exceptions:

>>>>> "Martin" == Martin Krischik <krischik@users.sourceforge.net> writes:

    Martin> Store them in an booch component map indexed by thread
    Martin> id. I do that in AdaCL.Trace.

>>>>> "tmoran" == tmoran <tmoran@acm.org> writes:

    tmoran> I don't understand why this is considered a problem. Why not make:
    tmoran> type data_to_pass is record ...
    tmoran> function enstring(x : data_to_pass) return string;
    tmoran> function destring(s : string) return data_to_pass;

Again, both solutions don't feel "right" to me, they seem more work
arounds rather then proper solutions.

For example, if you use the string encoding method to encode a pointer
(and do it in a type safe manner), in order to work around the maximum
string limits, this means you have to allocate the memory first, or
use a global buffer that is of fixed length and could be overwritten.

Similarly, the booch component model no doubt will require allocation
of additional memory, too.

But what if the exception that is being processed is of a direct
result of a out of memory error? (obviously I am assuming this is on
some system, eg. embedded systems, that detects out of memory errors
before it is too late). Even if it isn't the out of memory exception
itself, a program may need to throw a new exception in response to an
out of memory error. No doubt multiple threads may get out of memory
errors simultaneously too, as they probably are sharing the same
memory pool.

(disclaimer: I am assuming, and would hope, that throwing an exception
doesn't require allocating memory, otherwise disregard the above
paragraph).

The above solutions seem to make a simple task complicated; you
wouldn't consider passing parameters to functions, procedures, or
tasks by encoding them to strings or storing them in a global
component container, so why should exceptions be any different?

Sidenote:

I seem to remember that there is a good review of the limitations of
exception handling in Ada in the following reference:

Author: Burns, Alan, 1953-
Title: Real-time systems and programming languages : Ada 95, real-time Java, and real-time POSIX / Alan Burns and Andy Wellings.
3rd ed.
Publisher: Harlow ; New York : Pearson Education, 2001.
Description: xvi, 738 p. :

In this book, Ada gets a pretty good rating, but falls down with
exception handling, and the author lists his reasons, one of them
being this one discussed. It seems to be a pretty good book overall,
which makes comparisons between a number of languages.

Unfortunately I don't have the book handy right now (it is a library
book), so I can't cite from it.

-- 
Brian May <bam@snoopy.apana.org.au>


Relevant Pages

  • Re: How to troubleshoot bugchecks on my own?
    ... not a memory problem. ... From that exception record and context, ... execute the instruction - without a problem. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Bsod irql_not_less_or_equal
    ... *** Memory manager detected 2 instanceof page corruption, ... likely to have memory corruption. ... the driver/function that caused the problem. ... The exception code that was not handled ...
    (microsoft.public.windows.vista.performance_maintenance)
  • Re: Strange sudden shutdown issue with CF app
    ... Phone devices are notoriously low on virtual memory right out of the box because the OEMs decide to put every little thing into its own DLL and then have 25 processes launched at boot. ... Chris Tacke, Embedded MVP ... We have created an app that basically connects to a web service gets data, then stores it locally on the device, and when a record needs to be modified/added the system first tries to connect the web server sees if its availible, if not then it stores in locally on the device until the connection comes back, now I noticed that if the device does not mess around with the data connection then the application sits nicely as long as its open, and never gets shut down. ... But again most of the time I get no exception at all but just simply disappears. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: error wince600 boot message after dowload PB6 OS to HW board
    ... I would suspect that you have a memory layout problem, either the bootloader is using memory that is clobbering the downloaded image in some way, or the memory layout in the config.bib is wrong. ... Old or invalid version stamp in kernel structures - starting clean! ... Exception 'Access Violation': Thread-Id=00410002, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Strange sudden shutdown issue with CF app
    ... Phone devices are notoriously low on virtual memory right out of the box because the OEMs decide to put every little thing into its own DLL and then have 25 processes launched at boot. ... Chris Tacke, Embedded MVP ... We have created an app that basically connects to a web service gets data, then stores it locally on the device, and when a record needs to be modified/added the system first tries to connect the web server sees if its availible, if not then it stores in locally on the device until the connection comes back, now I noticed that if the device does not mess around with the data connection then the application sits nicely as long as its open, and never gets shut down. ... But again most of the time I get no exception at all but just simply disappears. ...
    (microsoft.public.dotnet.framework.compactframework)