I'm following a tutorial to get a better understanding of how things are passed around through stack frames, but they're working on a x86 system and I'm on x64.
when they've reached the step
sub esp, 0x10
=> mov eax, DWORD PTR [ebp+0xC]
add eax, 0x4
They're able to see the address the pointer is pointing to. Checking the value, they get the address
Then running x/s on that address returns the string value, which in this case should be the location of the program '/root/Desktop/00byte'
Where things are different for me is on x64 my instructions say
sub rsp, 0x10
mov DWORD PTR [rbp-0x4], edi
mov QWORD PTR [rbp-0x10], rsi
=> mov rax, QWORD PTR [rbp-0x10]
add rax, 0x8
We've both assembled the same code and set our breakpoints on the same line, but on different platforms and I wanted to know how I'd be able to get the address from this point. I had assumed running
would return the address of the pointer but instead it returns
Am I wrong to think the address of the pointer is stored in rax at this point? And if so, how would I get the address from this point.
I can provide more information if needed. We're both using gcc to compile and gdb to debug and using the same arguments when building the program.
I also tried checking the value in $rbp-16 but that only returns:
So I'm not sure where the address is stored at this point in a way that I could examine based on the instructions I have.
*here's the code, we both put our breakpoints after the line where main() is declared:
void echo(char *message)
int main(int argc, char *argv)
an argument is passed to the program and I'm observing how that argument moves through the stack.