Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Assembly 

Checking Values on Stack

I want to print 1 words from the top of stack in the form of hexadecimal. To do so, I typed the following:

Code
(gdb) x/1xw $esp
but GDB keeps popping up:

Code
0xffffffffffffe030:     Cannot access memory at address 0xffffffffffffe030

The program I'm trying to debug has already pushed a value onto stack so just in case if you're wondering that I might be trying to access kernel variables at the very beginning of program, it's not so. Any idea?
I have no idea what architecture you're on.
What OS you're on.
You didn't paste any code. Clearly the problem is the ESP register because GDB is accessing invalid memory when it tries to read ESP.
At the start of your program, check ESP and EBP. Then push onto the stack and check ESP again.
You're tampering with ESP somewhere in your code, there's no other reason why it would holding an invalid memory address.
(Jul 27, 2017 02:08 PM)Mischa Wrote:  I have no idea what architecture you're on.
What OS you're on.
You didn't paste any code. Clearly the problem is the ESP register because GDB is accessing invalid memory when it tries to read ESP.
At the start of your program, check ESP and EBP. Then push onto the stack and check ESP again.
You're tampering with ESP somewhere in your code, there's no other reason why it would holding an invalid memory address.

I found the reason why I had problem accessing the address space. 0xffffffffffffe030 is actually a 64 bit address and I tried to access it using esp which is a 32 bit register. I changed
Code
(gdb) x/1xw $esp
to
Code
(gdb) x/1xw $rsp
and every thing works fine now!!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by bigfatjoeApr 3, 2024 02:33 AM 5 189 Apr 3, 2024 02:33 AM
Last Post: siliconvalley
by blackcoder00Jul 23, 2020 06:24 AM 5 138 Jul 23, 2020 06:24 AM
Last Post: blackcoder00
by RenovatumMar 2, 2018 01:48 PM 3 167 Mar 2, 2018 01:48 PM
Last Post: Renovatum