Re: How frame command with address works

Simon Marchi via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>

On 2/9/23 05:43, Roger Phillips wrote:
> Thanks for your answer. I tried frame view on an intact callstack that works with bt for test purposes:
> 
> (gdb) f 2
> #2  0x0000007f9eaa2c68 someFunc (this=0x3a015370, timeout=4294967295, selector=0x0)
>     at <sourcecode>
> (gdb) p $sp
> $20 = (void *) 0x7f9c256630
> (gdb) p $pc
> $21 = (void (*)(void)) 0x7f9eaa2c68 
> (gdb) frame view 0x7f9c256630 0x7f9eaa2c68
> #0  0x0000007f9eaa2c68 in somefunc (this=0x3a01540c, timeout=1, 
>     selector=0x7f9eaa2be0 )
>     at <sourcecode>
> 
> It can be seen that the this pointer is different from the frame view result. It always is 0x3a01540c regardless on how I set the stack pointer or program counter.
> It seems to me that while it sets the pc correctly it pulls the args always from frame 0.

This is probably because GDB reads registers from the current target,
when viewing a user-created frame.  Yeah, it's odd, and part of why I
find that feature a bit strange.

Simon
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.