comp.lang.ada
 help / color / mirror / Atom feed
From: Corey Ashford <corey@rational.com>
To: Axel Boness <abn@sema-grenoble.fr>
Subject: Re: Stack, task size and DEC Ada
Date: 1997/02/07
Date: 1997-02-07T00:00:00+00:00	[thread overview]
Message-ID: <32FC2FD4.5039@rational.com> (raw)
In-Reply-To: 32FA17E0.7566@sema-grenoble.fr


Axel Boness wrote:
>> I am now desesperate because I can't find a formula that gives me the
> stack used/free in function of the adress of my variable and the info
> given by GET_TASK_INFO.GET_CURRENT_TASK_STACK_TOP and
> GET_TASK_INFO.GET_CURRENT_TASK_STACK_BASE.

Assuming the following:

The stack grows downward from high addresses toward lower addresses.

The stack top is the highest address the stack pointer will be at

The stack base is the lowest address the stack pointer will be at
(a.k.a. the stack limit)

You could make a routine that starts searching memory upward from the
stack base until it finds a non-zero word, or until it runs into the
stack top, whichever comes first.   It's virtually impossible that
you'll ever hit the top because *some* space must be used, but it's
just a backstop in case there's an error somewhere.

Once you find the first non-zero word, that'll be the high-water mark.
This assumes, of course, that stacks are zeroed out on task start-up.

This is essentially the technique our debugger uses to display task
stack usage.

Hope this helps

- Corey




      parent reply	other threads:[~1997-02-07  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <32FA17E0.7566@sema-grenoble.fr>
1997-02-07  0:00 ` Stack, task size and DEC Ada Mats Weber
1997-02-07  0:00 ` Corey Ashford [this message]
replies disabled

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