comp.lang.ada
 help / color / mirror / Atom feed
* Newbie with a question
@ 2001-04-27 21:46 Paul Storm
  2001-04-28  3:56 ` Peter Richtmyer
  2001-04-28 18:10 ` Jeffrey Carter
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Storm @ 2001-04-27 21:46 UTC (permalink / raw)


I am fairly new to Ada.  I am working on a program and have created the
following excerpt. <begin code>

if ( Type_Is_Buffer and not Buffer_Found ) then

  Log_Error
          (
           Source            => Source,
           Message           => "Put message here about missing buffer
size" ,
           Verbosity         => Default_Verbosity
          ) ;

  raise Data_Point_Buffer_Size_Needed_Error ;

end if;

<end code>

If this section of code runs the exception is raised and execution
abends.
But the message is not put into the log.  Which should be done by the
Log_Error call.

The Log_Error procedure is legacy code and works fine elsewhere in the
program.

Anyone have suggestions as to why this would be the case?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Newbie with a question
  2001-04-27 21:46 Newbie with a question Paul Storm
@ 2001-04-28  3:56 ` Peter Richtmyer
  2001-04-28 18:10 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Richtmyer @ 2001-04-28  3:56 UTC (permalink / raw)



"Paul Storm" <paul.a.storm@lmco.com> wrote in message
news:3AE9E89C.5B6909E1@lmco.com...
> I am fairly new to Ada.  I am working on a program and have created the
> following excerpt. <begin code>
>
> if ( Type_Is_Buffer and not Buffer_Found ) then
>
>   Log_Error
>           (
>            Source            => Source,
>            Message           => "Put message here about missing buffer
> size" ,
>            Verbosity         => Default_Verbosity
>           ) ;
>
>   raise Data_Point_Buffer_Size_Needed_Error ;
>
> end if;
>
> <end code>
>
> If this section of code runs the exception is raised and execution
> abends.

I assume that you get the CORRECT exception that you are raising,
        - not some other, right?

> But the message is not put into the log.  Which should be done by the
> Log_Error call.
>
I suggest:
    - use a debugger if possible to step through it. or
    - comment out the "Raise" temporarily and see if Log_Error works.
      Maybe the data is being buffered and never gets written. or
    - Take a look at your "Default_Verbosity" value (or display it) and see
      if the "Verbosity" is being set to some value that says "Do not put
the
      message in the log", or
    - All the above until something clicks.

Different people have different "styles" when debugging. Your style
will help dictate which of the suggestions above (if any) you try.

> The Log_Error procedure is legacy code and works fine elsewhere in the
> program.
>
> Anyone have suggestions as to why this would be the case?

Good Luck!
Peter
"Expect the Best...."





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Newbie with a question
  2001-04-27 21:46 Newbie with a question Paul Storm
  2001-04-28  3:56 ` Peter Richtmyer
@ 2001-04-28 18:10 ` Jeffrey Carter
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey Carter @ 2001-04-28 18:10 UTC (permalink / raw)


Paul Storm wrote:
> 
> if ( Type_Is_Buffer and not Buffer_Found ) then
> 
>   Log_Error
>           (
>            Source            => Source,
>            Message           => "Put message here about missing buffer
> size" ,
>            Verbosity         => Default_Verbosity
>           ) ;
> 
>   raise Data_Point_Buffer_Size_Needed_Error ;
> 
> end if;
> 
> <end code>
> 
> If this section of code runs the exception is raised and execution
> abends.
> But the message is not put into the log.  Which should be done by the
> Log_Error call.
> 
> The Log_Error procedure is legacy code and works fine elsewhere in the
> program.

Program termination due to an unhandled exception is not really
abnormal. The Ada runtime should terminate the program normally when an
unhandled exception is raised.

However, what that means differs on different systems. On many desktop
and workstation systems, the runtime will close any open files before
terminating, but on some real-time systems this won't happen. Possibly
writing to the log is buffered and the buffer is not being written
before the program terminates. You can test this by handling the
exception at the top level and closing the log file before reraising the
exception, or by closing the log file before raising the exception.

It's also possible that your verbosity level results in the message not
being put in the log.

-- 
Jeff Carter
"You brightly-colored, mealy-templed, cranberry-smelling, electric
donkey-bottom biters."
Monty Python & the Holy Grail



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-28 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-27 21:46 Newbie with a question Paul Storm
2001-04-28  3:56 ` Peter Richtmyer
2001-04-28 18:10 ` Jeffrey Carter

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