comp.lang.ada
 help / color / mirror / Atom feed
* Idea: use JGNAT for memory debugging?
@ 2003-02-05  6:51 Victor Porton
  2003-02-05 10:32 ` Colin Paul Gloster
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Victor Porton @ 2003-02-05  6:51 UTC (permalink / raw)


I have a problem with an Ada program, which is possibly access to a 
dangling reference (e.g. after Unchecked_Deallocation).

Do I guess rightly that JGNAT (as opposed to normal Gnat) will detect 
this problem for me? Is JGNAT free?

In general how to find dereferencing dangling references in Ada? I 
would use an OO wrapper around accesses which would do reference 
counting (in debug mode), but living entirely without accesses seems
bad.



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

* Re: Idea: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
@ 2003-02-05 10:32 ` Colin Paul Gloster
  2003-02-05 12:12 ` Jeffrey Creem
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Colin Paul Gloster @ 2003-02-05 10:32 UTC (permalink / raw)


In news:3e40b4ae$0$344$bed64819@news.gradwell.net , Victor Porton wrote:
"I have a problem with an Ada program, which is possibly access to a 
dangling reference (e.g. after Unchecked_Deallocation).

Do I guess rightly that JGNAT (as opposed to normal Gnat) will detect 
this problem for me?"

I doubt it. JGNAT targets a Java Virtual Machine, so its output is
bytecode instead of real native machine code. What you give it is still
regular Ada code, though the JVM's behavior would probably include garbage
collection.

"Is JGNAT free?

[..]"

Yes, but no longer in development.



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

* Re: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
  2003-02-05 10:32 ` Colin Paul Gloster
@ 2003-02-05 12:12 ` Jeffrey Creem
  2003-02-05 13:53 ` Victor Porton
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeffrey Creem @ 2003-02-05 12:12 UTC (permalink / raw)


Perhaps gnatmem can help (not entirely clear what you are seeing)

Also, make sure you are building with all run-time checks enabled (gnato and
fstack-check)

Finally, take a look at the section of that GNAT User's Guide titled

Finding Memory Problems with GNAT Debug Pool


"Victor Porton" <porton@ex-code.com> wrote in message
news:3e40b4ae$0$344$bed64819@news.gradwell.net...
> I have a problem with an Ada program, which is possibly access to a
> dangling reference (e.g. after Unchecked_Deallocation).





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

* Re: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
  2003-02-05 10:32 ` Colin Paul Gloster
  2003-02-05 12:12 ` Jeffrey Creem
@ 2003-02-05 13:53 ` Victor Porton
  2003-02-05 15:49 ` Idea: " Florian Weimer
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Victor Porton @ 2003-02-05 13:53 UTC (permalink / raw)


In article <4d70a.174206$rM2.163404@rwcrnsc53>,
	"Jeffrey Creem" <jeff@thecreems.com> writes:
> Perhaps gnatmem can help (not entirely clear what you are seeing)
> 
> Also, make sure you are building with all run-time checks enabled (gnato and
> fstack-check)
> 
> Finally, take a look at the section of that GNAT User's Guide titled
> 
> Finding Memory Problems with GNAT Debug Pool

Already all of this.

These may not find the cases of accessing dangling references.



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

* Re: Idea: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
                   ` (2 preceding siblings ...)
  2003-02-05 13:53 ` Victor Porton
@ 2003-02-05 15:49 ` Florian Weimer
  2003-02-05 18:48 ` Stephen Leake
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Florian Weimer @ 2003-02-05 15:49 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> In general how to find dereferencing dangling references in Ada?

valgrind?



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

* Re: Idea: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
                   ` (3 preceding siblings ...)
  2003-02-05 15:49 ` Idea: " Florian Weimer
@ 2003-02-05 18:48 ` Stephen Leake
  2003-02-06  2:00 ` Victor Porton
  2003-02-07 18:22 ` Jean-Claude Mahieux
  6 siblings, 0 replies; 8+ messages in thread
From: Stephen Leake @ 2003-02-05 18:48 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> I have a problem with an Ada program, which is possibly access to a 
> dangling reference (e.g. after Unchecked_Deallocation).
> 
> Do I guess rightly that JGNAT (as opposed to normal Gnat) will detect 
> this problem for me? 

No. Instead, it will silently "fix" it for you; it won't actually
deallocate the object until all the references are truly gone.

> Is JGNAT free?

Yes, in both the license and cost sense.

> In general how to find dereferencing dangling references in Ada? I
> would use an OO wrapper around accesses which would do reference
> counting (in debug mode), but living entirely without accesses seems
> bad.

I agree, living without accesses is bad. But apparently you are also
copying accesses; that takes more care.

Reference counting is probably the best way to go here. But done
right, it will only mask your problem (since the reference count will
be incremented by the copy).

So it depends on what you think "the problem" is; have you made an
unnecessary copy of a pointer, or have you deallocated something
before you were truly done with it? A careful review of your
allocation/deallocation/copying policies and design will help.

-- 
-- Stephe



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

* Re: Idea: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
                   ` (4 preceding siblings ...)
  2003-02-05 18:48 ` Stephen Leake
@ 2003-02-06  2:00 ` Victor Porton
  2003-02-07 18:22 ` Jean-Claude Mahieux
  6 siblings, 0 replies; 8+ messages in thread
From: Victor Porton @ 2003-02-06  2:00 UTC (permalink / raw)


In article <87smv2pw0z.fsf@deneb.enyo.de>,
	Florian Weimer <fw@deneb.enyo.de> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> In general how to find dereferencing dangling references in Ada?
> 
> valgrind?

Amything special about valgrind and Ada? Particularly how it deals with 
Ada's allocation/deallocation which may be not the same as 
malloc()/free()? Maybe desirable to link with a special library which 
would replace __gnat_malloc()/__gnat_free() to be more valgrind free?



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

* Re: use JGNAT for memory debugging?
  2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
                   ` (5 preceding siblings ...)
  2003-02-06  2:00 ` Victor Porton
@ 2003-02-07 18:22 ` Jean-Claude Mahieux
  6 siblings, 0 replies; 8+ messages in thread
From: Jean-Claude Mahieux @ 2003-02-07 18:22 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

you should probably use something like aprobe
(see http://www.ocsystems.com/)

--
Jean-Claude MAHIEUX
Top Graph'X Sales Manager
10 All�e de la Mare Jacob
91290 La Norville - FRANCE
Tel : +33 1 69 26 97 88
Fax : +33 1 69 26 97 89
Email : sales@topgraphx.com
URL : http://www.topgraphx.com
German Representative : orbriver-de@topgraphx.com
US Representative : sroliver@topgraphx.com

"Victor Porton" <porton@ex-code.com> a �crit dans le message de news:
3e40b4ae$0$344$bed64819@news.gradwell.net...
> I have a problem with an Ada program, which is possibly access to a
> dangling reference (e.g. after Unchecked_Deallocation).
>
> Do I guess rightly that JGNAT (as opposed to normal Gnat) will detect
> this problem for me? Is JGNAT free?
>
> In general how to find dereferencing dangling references in Ada? I
> would use an OO wrapper around accesses which would do reference
> counting (in debug mode), but living entirely without accesses seems
> bad.





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

end of thread, other threads:[~2003-02-07 18:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-05  6:51 Idea: use JGNAT for memory debugging? Victor Porton
2003-02-05 10:32 ` Colin Paul Gloster
2003-02-05 12:12 ` Jeffrey Creem
2003-02-05 13:53 ` Victor Porton
2003-02-05 15:49 ` Idea: " Florian Weimer
2003-02-05 18:48 ` Stephen Leake
2003-02-06  2:00 ` Victor Porton
2003-02-07 18:22 ` Jean-Claude Mahieux

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