[lldb][AArch64] Save/restore TLS registers around expressions
authorDavid Spickett <david.spickett@linaro.org>
Fri, 28 Jul 2023 08:03:40 +0000 (08:03 +0000)
committerTobias Hieta <tobias@hieta.se>
Thu, 10 Aug 2023 07:04:42 +0000 (09:04 +0200)
commitbc0a7de379e6c2540a551d7ca6ba2cf733347a3f
tree16f821778b05dccfa891cbe3545862846c6656d9
parent010314325a1469911d4be2b5b7cdb8931b984861
[lldb][AArch64] Save/restore TLS registers around expressions

This was cherry-picked from 6239227172cdc92f3bb72131333f50f83a6439cf and has been
modified to remove references to the tpidr2 register that is not supported on
the 17 branch.

Previously lldb was storing them but not restoring them. Meaning that this function:
```
void expr(uint64_t value) {
  __asm__ volatile("msr tpidr_el0, %0" ::"r"(value));
}
```
When run from lldb:
```
(lldb) expression expr()
```
Would leave tpidr as `value` instead of the original value of the register.

A check for this scenario has been added to TestAArch64LinuxTLSRegister.py,

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D156512
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
lldb/test/API/linux/aarch64/tls_register/TestAArch64LinuxTLSRegister.py
lldb/test/API/linux/aarch64/tls_register/main.c