[Lldb-commits] [lldb] [lldb] Add test showing UnwindAssemblyInstEmulation can't handle backwards branches (PR #168398)

via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 17 08:32:49 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp b/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp
index 4ab9bb554..c110b0782 100644
--- a/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp
+++ b/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp
@@ -870,25 +870,76 @@ TEST_F(TestArm64InstEmulation, TestMidFunctionEpilogueAndBackwardsJump) {
   UnwindPlan::Row::AbstractRegisterLocation regloc;
 
   uint8_t data[] = {
-      0xff, 0xc3, 0x00, 0xd1, // <+0>:  sub    sp, sp, #0x30
-      0xfd, 0x7b, 0x02, 0xa9, // <+4>:  stp    x29, x30, [sp, #0x20]
-      0xfd, 0x83, 0x00, 0x91, // <+8>:  add    x29, sp, #0x20
-      0x1f, 0x04, 0x00, 0xf1, // <+12>: cmp    x0, #0x1
-      0x21, 0x01, 0x00, 0x54, // <+16>: b.ne   ; <+52> DO_SOMETHING_AND_GOTO_AFTER_EPILOGUE
-      0xfd, 0x7b, 0x42, 0xa9, // <+20>: ldp    x29, x30, [sp, #0x20]
-      0xff, 0xc3, 0x00, 0x91, // <+24>: add    sp, sp, #0x30
-      0xc0, 0x03, 0x5f, 0xd6, // <+28>: ret
+      0xff,
+      0xc3,
+      0x00,
+      0xd1, // <+0>:  sub    sp, sp, #0x30
+      0xfd,
+      0x7b,
+      0x02,
+      0xa9, // <+4>:  stp    x29, x30, [sp, #0x20]
+      0xfd,
+      0x83,
+      0x00,
+      0x91, // <+8>:  add    x29, sp, #0x20
+      0x1f,
+      0x04,
+      0x00,
+      0xf1, // <+12>: cmp    x0, #0x1
+      0x21,
+      0x01,
+      0x00,
+      0x54, // <+16>: b.ne   ; <+52> DO_SOMETHING_AND_GOTO_AFTER_EPILOGUE
+      0xfd,
+      0x7b,
+      0x42,
+      0xa9, // <+20>: ldp    x29, x30, [sp, #0x20]
+      0xff,
+      0xc3,
+      0x00,
+      0x91, // <+24>: add    sp, sp, #0x30
+      0xc0,
+      0x03,
+      0x5f,
+      0xd6, // <+28>: ret
       // AFTER_EPILOGUE:  LLDB computes the next 5 unwind states incorrectly.
-      0x37, 0x00, 0x80, 0xd2, // <+32>: mov    x23, #0x1
-      0xf6, 0x5f, 0x41, 0xa9, // <+36>: ldp    x22, x23, [sp, #0x10]
-      0xfd, 0x7b, 0x42, 0xa9, // <+40>: ldp    x29, x30, [sp, #0x20]
-      0xff, 0xc3, 0x00, 0x91, // <+44>: add    sp, sp, #0x30
-      0xc0, 0x03, 0x5f, 0xd6, // <+48>: ret
+      0x37,
+      0x00,
+      0x80,
+      0xd2, // <+32>: mov    x23, #0x1
+      0xf6,
+      0x5f,
+      0x41,
+      0xa9, // <+36>: ldp    x22, x23, [sp, #0x10]
+      0xfd,
+      0x7b,
+      0x42,
+      0xa9, // <+40>: ldp    x29, x30, [sp, #0x20]
+      0xff,
+      0xc3,
+      0x00,
+      0x91, // <+44>: add    sp, sp, #0x30
+      0xc0,
+      0x03,
+      0x5f,
+      0xd6, // <+48>: ret
       // DO_SOMETHING_AND_GOTO_AFTER_EPILOGUE
-      0xf6, 0x5f, 0x01, 0xa9, // <+52>: stp    x22, x23, [sp, #0x10]
-      0x36, 0x00, 0x80, 0xd2, // <+56>: mov    x22, #0x1
-      0x37, 0x00, 0x80, 0xd2, // <+60>: mov    x23, #0x1
-      0xf8, 0xff, 0xff, 0x17, // <+64>: b      ; <+32> AFTER_EPILOGUE
+      0xf6,
+      0x5f,
+      0x01,
+      0xa9, // <+52>: stp    x22, x23, [sp, #0x10]
+      0x36,
+      0x00,
+      0x80,
+      0xd2, // <+56>: mov    x22, #0x1
+      0x37,
+      0x00,
+      0x80,
+      0xd2, // <+60>: mov    x23, #0x1
+      0xf8,
+      0xff,
+      0xff,
+      0x17, // <+64>: b      ; <+32> AFTER_EPILOGUE
   };
 
   // UnwindPlan we expect:

``````````

</details>


https://github.com/llvm/llvm-project/pull/168398


More information about the lldb-commits mailing list