From: anon@anon.org (anon)
Subject: Re: Yes it is possible. Re: Stackusage at runtime
Date: Wed, 05 Nov 2008 21:55:17 GMT
Date: 2008-11-05T21:55:17+00:00 [thread overview]
Message-ID: <9DoQk.114148$Mh5.113208@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: 3c9a589e-da1c-4d8c-b42e-e84bcde38739@g17g2000prg.googlegroups.com
Because a few questions here are from students, that may want to bypass the
research, you should give a partial answer that leads them to learn how things
work. And not the complete answer the first time around or send them to get
a package that is going to cost them, unless they ask for it.
No one here even suggested looking at GNAT's documentation for an example of
"Inline Assembler", did they. The only problem is that the correct Assembly
statements or opcodes need to be inserted in the Ada "Asm" statement for
the PPC. Now this version is for intel x86 version and not PPC because I did
not want to dusty off my PPC assembly books, but one should be able to
adopt the code for PPC.
-- Intel version
package Unsigned_32_IO is new Modular_IO ( Unsigned_32 ) ;
...
-- routine returns SP (stack index reg) into a unsigned_32 variable
Asm ( Template => "movl %%eax, %%esp",
Outputs => Unsigned_32'Asm_Output ( "=a", Offset ),
Volatile => True ) ;
--
Put ( "Intel SP Register := " ) ;
Unsigned_32_IO.Put ( Offset, Base => 16 ) ;
New_Line ;
...
And you can make this routine into a procedure like in a debug package, But
in that case you would have to adjust the offset. And you could even add a
routine that can dump apart of the stack if needed by expanding the idea
of using "System.Machine_Code" package.
But Ludovic Brenta is quick at doing nothing but cutting people down! Even
if Brenta does not understand, also I see Ludovic Brenta had no answer to
give. So Ludovic Brenta should get back and fix Annex -E for Debian and let
people help those who need it.
In <3c9a589e-da1c-4d8c-b42e-e84bcde38739@g17g2000prg.googlegroups.com>, Ludovic Brenta <ludovic@ludovic-brenta.org> writes:
>anon wrote:
>> To monitor the main (system) stack that GNAT uses, you need to alter the
>> System.Memory package to include some monitoring information like in
>> the following code. Some may not like it but it get the job done.
>[...]
>
>> =A0 begin
>> =A0 =A0 Put ( "Before create Integer :=3D " ) ;
>> =A0 =A0 S_IO.Put ( Stack_Monitor ) ;
>> =A0 =A0 A :=3D new Integer ;
>> =A0 =A0 Put ( " after create operation :=3D " ) ;
>> =A0 =A0 S_IO.Put ( Stack_Monitor ) ;
>[...]
>
>As your example shows, your technique does not address the OP's
>problem; it monitors heap allocations (done via new), not the stack
>(done by declaring variables in subprograms).
>
>--
>Ludovic Brenta.
next prev parent reply other threads:[~2008-11-05 21:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 7:55 Stackusage at runtime andi.vontobel
2008-11-04 11:44 ` Georg Bauhaus
2008-11-04 12:56 ` Andy
2008-11-04 15:40 ` Stuart
2008-11-04 19:05 ` Andi
2008-11-04 20:44 ` Niklas Holsti
2008-11-05 18:50 ` Niklas Holsti
2008-11-04 19:41 ` Yes it is possible. " anon
2008-11-05 9:31 ` Ludovic Brenta
2008-11-05 21:55 ` anon [this message]
2008-11-05 23:07 ` Ludovic Brenta
2008-11-06 5:00 ` anon
2008-11-06 10:17 ` Georg Bauhaus
2008-11-06 18:18 ` Pascal Obry
2008-11-07 10:19 ` Georg Bauhaus
2008-11-07 11:58 ` anon
2008-11-04 20:07 ` Per Sandberg
2008-11-05 7:33 ` Andy
2008-11-05 16:50 ` Per Sandberg
2008-11-05 17:31 ` Jean-Pierre Rosen
2008-11-05 18:19 ` Keith Thompson
2008-11-05 21:38 ` nobody
2008-11-05 20:14 ` sjw
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox