comp.lang.ada
 help / color / mirror / Atom feed
* debugging tool?
@ 2004-02-21  5:56 tmoran
  2004-02-22 21:25 ` Hyman Rosen
  0 siblings, 1 reply; 9+ messages in thread
From: tmoran @ 2004-02-21  5:56 UTC (permalink / raw)


Is there a tool around that would scan a large program to check for
instances of an object being accessed *after* it's been Finalized?
As in this program, where two compilers happily allow just that for
Helper, and a third doesn't, but gives no error message.

with ada.finalization;
package testff1 is
  type A is new ada.finalization.controlled with null record;
  procedure Finalize(x : in out A);
  AA : A;
private
  type Helper_Type(id : integer) is new ada.finalization.controlled with null record;
  procedure Finalize(x : in out Helper_Type);
  procedure dummy(x : in out Helper_Type);
end testff1;

with ada.text_io;
package body testff1 is

  Helper : Helper_Type(1);

  procedure Finalize(x : in out Helper_Type) is
  begin
    ada.text_io.put_line("finalize helper" & integer'image(x.id));
  end Finalize;

  procedure dummy(x : in out Helper_Type) is
  begin
    ada.text_io.put_line("process Helper" & integer'image(x.id));
  end dummy;

  procedure Finalize(x : in out A) is
  begin
    ada.text_io.put_line("finalize A");
    dummy(Helper);
  end Finalize;

end testff1;

with ada.exceptions;
with ada.text_io;
with testff1;
procedure testff is
  My_A : testff1.A;
begin
  ada.text_io.put_line("main");
exception
  when oops:others=>ada.text_io.put_line(ada.exceptions.exception_information(oops));
end testff;



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

end of thread, other threads:[~2004-02-23  5:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-21  5:56 debugging tool? tmoran
2004-02-22 21:25 ` Hyman Rosen
2004-02-22 22:17   ` tmoran
2004-02-22 23:18     ` Stephen Leake
2004-02-23  1:21       ` tmoran
2004-02-23  1:31         ` tmoran
2004-02-23  3:54           ` Stephen Leake
2004-02-23  5:43             ` tmoran
2004-02-23  3:34         ` Stephen Leake

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