[all-commits] [llvm/llvm-project] 09c64e: [lldb] Restore register state if PrepareTrivialCal...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Feb 28 07:58:51 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09c64e56d4b79421ea3ccb3e8766d1056725874d
      https://github.com/llvm/llvm-project/commit/09c64e56d4b79421ea3ccb3e8766d1056725874d
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
    M lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
    M lldb/source/Target/ThreadPlanCallFunction.cpp

  Log Message:
  -----------
  [lldb] Restore register state if PrepareTrivialCall fails (#129038)

Fixes #124269

PrepareTrivalCall always had the possibility of failing, but given that
it only wrote to general purpose registers, if it did, you had bigger
problems.

When it failed, we did not mark the thread plan valid and when it was
torn down we didn't try to restore the register state. This meant that
if you tried to continue, the program was unlikely to work.

When I added AArch64 GCS support, I needed to handle the situation where
the GCS pointer points to unmapped memory and we fail to write the extra
entry we need. So I added code to restore the gcspr_el0 register
specifically if this happened, and ordered the operations so that we
tried this first.

In this change I've made the teardown of an invalid thread plan restore
the register state if one was saved. It may be there isn't one if
ConstructorSetup fails, but this is ok because that function does not
modify anything.

Now that we're doing that, I don't need the GCS specific code anymore,
and all thread plans are protected from this in the rare event something
does fail.

Testing is done by the existing GCS test case that points the gcspr into
unmapped memory which causes PrepareTrivialCall to fail. I tried adding
a simulated test using a mock gdb server. This was not possible because
they all use DynamicLoaderStatic which disables all JIT features.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list