10

I am debugging a c program with gdb in linux terminal, I disassembled it and ran it, then tried to find the memory address the the EIP register. This is what happened:

(gdb) i r eip Invalid register `eip'

Why does it say that my eip register is invalid?

2
  • 1
    Is it a 64-bit program? If so, it's rip, not eip. Commented Feb 18, 2012 at 6:29
  • Yes that's it thank you I had no idea they were different names. Commented Feb 18, 2012 at 7:14

2 Answers 2

25

Is it a 64-bit program? If so, it's rip, not eip.

Sign up to request clarification or add additional context in comments.

3 Comments

Note that gdb allows you to refer to the program counter using $pc. This will work on both 32 and 64 bit, and also on other architectures.
So what to do if I want eip instead rip?
@DeepJadia You can't really choose because it's ip in 16-bit mode, eip in 32-bit mode and rip in 64-bit mode.
6

Depending on your program's architecture the register can change:

  • 16 bit - ip
  • 32 bit - eip
  • 64 bit - rip

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.