diff options
author | zhanglimin <zhanglimin@loongson.cn> | 2023-04-07 13:40:58 +0800 |
---|---|---|
committer | Weining Lu <luweining@loongson.cn> | 2023-04-07 13:42:23 +0800 |
commit | 366c5474a3002114b8980ab278d93baa96046385 (patch) | |
tree | e860610205d90e3c40bc4f8554f76eed16052cd8 /libunwind | |
parent | f38365aef436d0f2ae042ad3038c8a6159dafe78 (diff) | |
download | llvm-366c5474a3002114b8980ab278d93baa96046385.zip llvm-366c5474a3002114b8980ab278d93baa96046385.tar.gz llvm-366c5474a3002114b8980ab278d93baa96046385.tar.bz2 |
[libunwind][test] Add test to check for unw_resume()
This is here for local unwinding, which unw_resume() restores
the machine state and then directly resumes execution in the
target stack frame.
Reviewed By: wangleiat
Differential Revision: https://reviews.llvm.org/D147371
Diffstat (limited to 'libunwind')
-rw-r--r-- | libunwind/test/unw_resume.pass.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libunwind/test/unw_resume.pass.cpp b/libunwind/test/unw_resume.pass.cpp new file mode 100644 index 0000000..e652620a --- /dev/null +++ b/libunwind/test/unw_resume.pass.cpp @@ -0,0 +1,39 @@ +// -*- 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. + +// TODO: Investigate this failure on AIX system. +// XFAIL: target={{.*}}-aix{{.*}} + +// TODO: Figure out why this fails with Memory Sanitizer. +// XFAIL: msan + +// 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; +} |