[PATCH] D126611: [libunwind] Ensure test/libunwind_01.pass is not completely inlined
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 02:06:14 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8df257a6d0b0: [libunwind] Ensure test/libunwind_01.pass is not completely inlined (authored by arichardson).
Changed prior to commit:
https://reviews.llvm.org/D126611?vs=432778&id=438298#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126611/new/
https://reviews.llvm.org/D126611
Files:
libunwind/test/libunwind_01.pass.cpp
Index: libunwind/test/libunwind_01.pass.cpp
===================================================================
--- libunwind/test/libunwind_01.pass.cpp
+++ libunwind/test/libunwind_01.pass.cpp
@@ -15,6 +15,7 @@
#include <libunwind.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
void backtrace(int lower_bound) {
@@ -24,9 +25,17 @@
unw_cursor_t cursor;
unw_init_local(&cursor, &context);
+ char buffer[1024];
+ unw_word_t offset = 0;
+
int n = 0;
do {
- ++n;
+ n++;
+ if (unw_get_proc_name(&cursor, buffer, sizeof(buffer), &offset) == 0) {
+ fprintf(stderr, "Frame %d: %s+%p\n", n, buffer, (void*)offset);
+ } else {
+ fprintf(stderr, "Frame %d: Could not get name for cursor\n", n);
+ }
if (n > 100) {
abort();
}
@@ -37,18 +46,24 @@
}
}
-void test1(int i) {
+__attribute__((noinline)) void test1(int i) {
+ fprintf(stderr, "starting %s\n", __func__);
backtrace(i);
+ fprintf(stderr, "finished %s\n", __func__); // ensure return address is saved
}
-void test2(int i, int j) {
+__attribute__((noinline)) void test2(int i, int j) {
+ fprintf(stderr, "starting %s\n", __func__);
backtrace(i);
test1(j);
+ fprintf(stderr, "finished %s\n", __func__); // ensure return address is saved
}
-void test3(int i, int j, int k) {
+__attribute__((noinline)) void test3(int i, int j, int k) {
+ fprintf(stderr, "starting %s\n", __func__);
backtrace(i);
test2(j, k);
+ fprintf(stderr, "finished %s\n", __func__); // ensure return address is saved
}
void test_no_info() {
@@ -142,9 +157,9 @@
#endif
int main(int, char**) {
- test1(1);
- test2(1, 2);
- test3(1, 2, 3);
+ test1(3);
+ test2(3, 4);
+ test3(3, 4, 5);
test_no_info();
test_reg_names();
test_reg_get_set();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126611.438298.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220620/85592dd4/attachment.bin>
More information about the llvm-commits
mailing list