From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,434a111995b97e2f X-Google-Attributes: gid103376,public From: Corey Ashford Subject: Re: Stack, task size and DEC Ada Date: 1997/02/07 Message-ID: <32FC2FD4.5039@rational.com>#1/1 X-Deja-AN: 215272907 references: <32FA17E0.7566@sema-grenoble.fr> to: Axel Boness content-type: text/plain; charset=us-ascii organization: Rational Software Corp. mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.01 (X11; I; SunOS 5.4 sun4m) Date: 1997-02-07T00:00:00+00:00 List-Id: 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