[Lldb-commits] [PATCH] D154204: [lldb][AArch64] Account for extra libc frames in PAC unwind test
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 4 03:15:32 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG518320fd98d5: [lldb][AArch64] Account for extra libc frames in PAC unwind test (authored by DavidSpickett).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154204/new/
https://reviews.llvm.org/D154204
Files:
lldb/test/API/functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py
Index: lldb/test/API/functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py
===================================================================
--- lldb/test/API/functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py
+++ lldb/test/API/functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py
@@ -42,17 +42,31 @@
"func_b",
"func_a",
"main",
+ ]
+
+ libc_backtrace = [
"__libc_start_main",
"_start",
]
- self.assertEqual(thread.GetNumFrames(), len(backtrace))
- for frame_idx, frame in enumerate(thread.frames):
- frame = thread.GetFrameAtIndex(frame_idx)
+
+ self.assertTrue(thread.GetNumFrames() >= (len(backtrace) + len(libc_backtrace)))
+
+ # Strictly check frames that are in the test program's source.
+ for frame_idx, frame in enumerate(thread.frames[:len(backtrace)]):
self.assertTrue(frame)
self.assertEqual(frame.GetFunctionName(), backtrace[frame_idx])
- # Check line number for functions in main.c
- if frame_idx < 4:
- self.assertEqual(
- frame.GetLineEntry().GetLine(),
- line_number("main.c", "Frame " + backtrace[frame_idx]),
- )
+ self.assertEqual(
+ frame.GetLineEntry().GetLine(),
+ line_number("main.c", "Frame " + backtrace[frame_idx]),
+ )
+
+ # After the program comes some libc frames. The number varies by
+ # system, so ensure we have at least these two in this order,
+ # skipping frames in between.
+ start_idx = frame_idx + 1
+ for frame_idx, frame in enumerate(thread.frames[start_idx:], start=start_idx):
+ self.assertTrue(frame)
+ if libc_backtrace[0] == frame.GetFunctionName():
+ libc_backtrace.pop(0)
+
+ self.assertFalse(libc_backtrace, "Did not find expected libc frames.")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154204.537024.patch
Type: text/x-patch
Size: 2021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230704/393b5d18/attachment-0001.bin>
More information about the lldb-commits
mailing list