为什么数据段寄存器 (ds/es/fs/gs) 在 GDB 中似乎总是显示为 0x0?例如,无论我查看什么进程或线程,“info reg”似乎总是给我这样的输出:
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
Run Code Online (Sandbox Code Playgroud)
我正在尝试调试 glibc 代码,在我正在分解的函数中看到 fs 段前缀:
(gdb) disas __lll_lock_wait
Dump of assembler code for function __lll_lock_wait:
0x000000302800e240 <+0>: push %r10
0x000000302800e242 <+2>: push %rdx
0x000000302800e243 <+3>: xor %r10,%r10
0x000000302800e246 <+6>: mov $0x2,%edx
0x000000302800e24b <+11>: xor $0x80,%esi
0x000000302800e251 <+17>: and %fs:0x48,%esi
0x000000302800e259 <+25>: cmp %edx,%eax
0x000000302800e25b <+27>: jne 0x302800e264 <__lll_lock_wait+36>
0x000000302800e25d <+29>: mov $0xca,%eax
Run Code Online (Sandbox Code Playgroud)
我知道这就是 glibc 为 …