GDB 寄存器与处理器寄存器不同吗?

Are GDB registers different from processor registers?

gdb的$pc寄存器和x86 32位处理器的eip寄存器有区别吗? gdb 中有四个可用的标准寄存器,如 $pc。那么如果是同一个寄存器不同的名字那么映射是如何完成的呢?

GDB 中的 $pc 只是 ix86 上的 $EIPx86_64 上的 $RIP$pc 上的别名ARMMIPSSPARC,对于 ia64 上的 $ip,等等

what about the other three registers? I mean $sp, $fp and $ps

他们呢?在 ix86 上,$sp$esp 的别名,在 x86_64 上,它是 $RSP 的别名,在 MIPS 上,它是 [= 的别名28=],等等

$ps$EFLAGSix86x86_64 上的别名。 MIPS 上没有等效的寄存器,因此 $ps 没有映射到那里的任何内容。

if it is the same registers with different names then how the mapping is done

在GDB内部,有一个编译好的一对一映射。

I didn't get the point about compiled-in one to one

在 GDB 中字面上 有一张地图,看起来像这样:

if current target is i*86
  if the user typed $pc return $eip
  else if the user typed $fp return $ebp else
  ...
else if current target is x86_64
  if the user typed $pc return $rip
  else if the user typed $fp return $rbp
  ...

(这不是实际实现的方式,只是对一对一映射的解释。)