How to read memory with segment addressing mode in lldb on x86-64?

211 Views Asked by At

While debugging a process with lldb I get to this assembly instruction:

->  0x7ffff79c5187 <+7>:   movq   %fs:(%r14), %r14

Or in intel syntax:

->  0x7ffff79c5187 <+7>:   mov    r14, qword ptr fs:[r14]

Contents of the registers:

(lldb) register read fs
      fs = 0x0000000000000000
(lldb) register read r14
     r14 = 0xffffffffffffff08

I don't know how to calculate what address is being accessed here (just reading 0xffffffffffffff08 fails), so I would like to use the same addressing mode in order to get the address that is accessed here (then set a watchpoint).

I tried many address expressions, but they are all apparently invalid. Here are some of the ways I tried to read that memory:

x "$fs:($r14)"
x "%fs:(%r14)"
x "fs:(r14)"
x $rs
x $fs
memory read %fs:(%r14)
memory read 'qword ptr $fs:[$r14]'
memory read '%fs:(%r14)'
memory read '$fs:($r14)'
memory read '*(int **)$fs:($r14)'
memory read '*(int **)$fs:($r14)'
memory read '*(int *)$fs:($r14)'

But I always get

error: invalid start address expression.
error: address expression <my address expression> evaluation failed
0

There are 0 best solutions below