diff options
author | David Spickett <david.spickett@linaro.org> | 2023-10-25 09:16:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 09:16:58 +0100 |
commit | f2c09e5e16d592303b5a1c158cdef28ef08104f0 (patch) | |
tree | e774ba3538eb0e906b9e7f73b39cb78775ffa6a6 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp | |
parent | a7700985577694d6cc2498833f27b4fb5eeaf252 (diff) | |
download | llvm-f2c09e5e16d592303b5a1c158cdef28ef08104f0.zip llvm-f2c09e5e16d592303b5a1c158cdef28ef08104f0.tar.gz llvm-f2c09e5e16d592303b5a1c158cdef28ef08104f0.tar.bz2 |
[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)
This fixes a bug where writing vg during streaming mode
could prevent you reading za directly afterwards.
vg is invalidated just prior to us reading it in AArch64Reconfigure,
but svg was not. This lead to some situations where vg would be
updated or cleared and re-read, but svg would not be.
This meant it had some undefined value which lead to errors
that prevented us reading ZA. Likely we received a lot more
data than we were expecting.
There are at least 2 ways to get into this situation:
* Explicit write by the user to vg.
* We have just stopped and need to get the potentially new svg and vg.
The first is handled by invalidating svg client side before fetching the
new one. This also
covers some but not all of the second scenario. For the second, I've
made writes to vg
invalidate svg by noting this in the register information.
Whichever one of those kicks in, we'll get the latest value of svg.
The bug may depend on timing, I could not find a consistent way
to trigger it. I originally found it when checking whether za
is disabled after a vg change, so I've added checks for that
to TestZAThreadedDynamic.
The SVE VG version of the bug did show up on the buildbot,
but not consistently. So it's possible that TestZAThreadedDynamic
does in fact cover this, but I haven't run it enough times to know.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index b127d3d..7228092 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -783,6 +783,11 @@ void GDBRemoteRegisterContext::AArch64Reconfigure() { std::optional<uint64_t> svg_reg_value; const RegisterInfo *svg_reg_info = m_reg_info_sp->GetRegisterInfo("svg"); if (svg_reg_info) { + // When vg is written it is automatically made invalid. Writing vg will also + // change svg if we're in streaming mode but it will not be made invalid + // so do this manually so the following read gets the latest svg value. + SetRegisterIsValid(svg_reg_info, false); + uint32_t svg_reg_num = svg_reg_info->kinds[eRegisterKindLLDB]; uint64_t reg_value = ReadRegisterAsUnsigned(svg_reg_num, fail_value); if (reg_value != fail_value && reg_value <= 32) |