0

I understand the LEA means Load Effective Address and have read the documentation.

When I disassemble code using gdb I see:

lea    0x4(%esp),%ecx

I am having trouble understanding what is meant by?

0x4(%esp) 

Does it mean 0x4 offset from %esp or move the contents of ecx into four words above esp?

Thanks.

user1172468
  • 5,306
  • 6
  • 35
  • 62
  • 2
    If you have read the documentation you know `lea` does not access memory. Also at&t uses `src, dst` order so the contents of `ecx` are definitely not moved anywhere since that is the destinaton. It just does `ecx = esp + 4`. You can switch gnu tools into intel syntax mode if you are confused. Also you can use the debugger to see what is happening. – Jester Jul 18 '22 at 00:09
  • Thank you, @Jester, I have always been defeated with Assembly. So in 0x4(%esp) just means add 4 to esp? – user1172468 Jul 18 '22 at 00:23
  • 1
    Yes, that is exactly what it means. – Jester Jul 18 '22 at 00:25

0 Answers0