Re: GDB fetch argument value from the wrong stack-frame.

William Tambe <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAF8i9mMx59sfGbHQcOF6RaF-_QXAmGNwm1DyBo8FUuwuCjKxjA@mail.gmail.com>
To further expand on the issue that I am seeing, the gdb command "info
frame" reports "Arglist" and "Locals" at the same address.

Any idea what could be the reason causing GDB not to use previous
stack-frame to fetch an argument value ?

On Thu, Aug 15, 2019 at 11:08 PM William Tambe <[email protected]> wrote:
>
> I am running into an issue where when using the command "print arg"
> where arg is a function argument, GDB use an address within the
> current stack-frame instead of from the previous stack-frame.
>
> Any idea what needs to be implemented such that when accessing a
> function argument, GDB use instead an address from the previous
> stack-frame ?
>
> Below is an ascii drawing of a stackframe description:
>
> /* Stack after function's prologue:
>   SP ->+-----------------------+                         low addr
>        |   func arguments      | \
>        | that are created for  |  | pretendargs_size
>        | args of vararg funcs. | / |
>        +-----------------------+   | outargs_size (Include pretendargs_size)
>        |                       |   |
>        |    func arguments     |  /
>        |                       | /
>        +-----------------------+
>        |                       | \
>        |  local variables      |  | localvars_size
>        |                       | /
>        +-----------------------+
>        |  register save area   | \
>   FP ->+-----------------------+  |
>        |  previous frame ptr   |  | savedregs_size
>        +-----------------------+  |
>        |    return address     | /                       Callee
>   AP ->+-----------------------+------------------------------------
>        |   func arguments,     |                         Caller
>        | including those that  |
>        | are created for args  |
>        |   of vararg funcs.    |
>        +-----------------------+
>        |                       |
>        |   local variables     |
>        |                       |
>        +-----------------------+                         high addr
> */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.