[PATCH] D147371: [libunwind][test] Add test to check for unw_resume()
Limin Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 1 01:18:19 PDT 2023
Ami-zhang created this revision.
Ami-zhang added reviewers: SixWeining, wangleiat, xen0n, MaskRay.
Herald added projects: libunwind, All.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libunwind.
Ami-zhang requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is here for local unwinding, which unw_resume() restores
the machine state and then directly resumes execution in the
target stack frame.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147371
Files:
libunwind/test/unw_resume.pass.cpp
Index: libunwind/test/unw_resume.pass.cpp
===================================================================
--- /dev/null
+++ libunwind/test/unw_resume.pass.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Ensure that unw_resume() resumes execution at the stack frame identified by
+// cursor.
+
+// FIXME: The return address register($ra/$r1) is restored with a destroyed base
+// address register($a0/$r4) in the assembly file `UnwindRegistersRestore.S` on
+// LoongArch. And we will fix this issue in the next commit.
+// XFAIL: target={{loongarch64-.+}}
+
+#include <libunwind.h>
+
+void test_unw_resume() {
+ unw_context_t context;
+ unw_cursor_t cursor;
+
+ unw_getcontext(&context);
+ unw_init_local(&cursor, &context);
+ unw_step(&cursor);
+ unw_resume(&cursor);
+}
+
+int main() {
+ test_unw_resume();
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147371.510196.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230401/eab2a8f1/attachment.bin>
More information about the llvm-commits
mailing list