[Lldb-commits] [PATCH] D88583: [lldb] [test/Register] Add read/write tests for x87 regs

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 1 05:32:30 PDT 2020


mgorny added inline comments.


================
Comment at: lldb/test/Shell/Register/x86-fp-read.test:27-28
+# CHECK: fdivs (%{{[er]}}bx)
+print *(uint32_t*)($foseg * 0x100000000 + $fooff)
+# CHECK: (uint32_t) $1 = 0
+
----------------
labath wrote:
> zero is pretty common value. It would be better to check that the address actually points to the address of the `zero` variable. I think something like this ought to do it:
> ```
> print &zero
> # CHECK: (uint32_t *) $0 = [[ZERO:0x[0-9a-f]*]]
> print (uint32_t*)($foseg * 0x100000000 + $fooff)
> # CHECK: (uint32_t *) $1 = [[ZERO]]
> ```
> Something similar can be done with the disassemble command too. That way we'll see the actual register value in case it turns out to be wrong.
Cool idea, thanks!

As for FIP, I suppose that would require getting address corresponding to the FDIV instruction somehow. I suppose we can rely on constant-length encoding on `int3` and `fdivs ...`, so I guess `$rip-3` might work.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88583/new/

https://reviews.llvm.org/D88583



More information about the lldb-commits mailing list