Hello All,
i am working on an application where i need to find RIP value several times during execution of my application on 64 bit linux. this is relevant to stack walk algorithm on Linux 64 bit.
i can use asm instructions and ptrace for the same, but now i want to use some other algorithm for the same. for this understanding of the relationship between various registers in the memory is vital. mainly i am concentrating on RIP and RBP and the offset.
e.g. lets say i have call stack a()->b()->c(). now in c(), i want to implement stack walk algorithm so that i can print the IP addresses of c(), b() and a() from the stack.
i am able to read RBP for each stack frame from c() to a(). as current frame RBP stores previous frames RBP, this way navigation through simple pointer arithmetic is quite easy. but where does RIP value is being placed in the memory from the RBP? i tried to read pointer as RIP = *(RBP+8) but this does not work. i read that the value of RIP is at certain offset from RBP value and as the registers are of 8 byte size i tried to read this way..
is there any documentation which could clearly explain the memory modal for the Registers in 64 bit Linux.
Thanks,
Sandeep