GDB fetch argument value from the wrong stack-frame.

William Tambe tambewilliam@gmail.com
Fri Aug 16 04:23:00 GMT 2019


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 <tambewilliam@gmail.com> 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
> */



More information about the Gdb mailing list