GDB fetch argument value from the wrong stack-frame.

William Tambe <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAF8i9mPybzJS83mE8xhrcSSJLx33-WtrfY0bbq+JhBbRe6yyaw@mail.gmail.com>
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.