[PATCH] D24628: [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

Dmitry Vyukov via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 05:15:05 PDT 2016


dvyukov added a comment.

We need a test that passes non-NULL to these arguments and shows how to use the returned values.


================
Comment at: test/asan/TestCases/Linux/swapcontext_annotation.cc:176-199
@@ -164,7 +175,26 @@
     ret += Run(argc - 1, 0, stack);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: Main context from: [[CHILD_STACK]] 524288
     ret += Run(argc - 1, 1, stack);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: Main context from: [[CHILD_STACK]] 524288
     ret += Run(argc - 1, 2, stack);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: NextChild stack: [[NEXT_CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: NextChild from: [[CHILD_STACK]] 524288
+    // CHECK: Main context from: [[NEXT_CHILD_STACK]] 524288
     ret += Run(argc - 1, 0, heap);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: Main context from: [[CHILD_STACK]] 524288
     ret += Run(argc - 1, 1, heap);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: Main context from: [[CHILD_STACK]] 524288
     ret += Run(argc - 1, 2, heap);
+    // CHECK: Child stack: [[CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: NextChild stack: [[NEXT_CHILD_STACK:0x[0-9a-f]*]]
+    // CHECK: NextChild from: [[CHILD_STACK]] 524288
+    // CHECK: Main context from: [[NEXT_CHILD_STACK]] 524288
+
+    // CHECK: Iteration 0 passed
+    printf("Iteration %d passed\n", i);
   }
----------------
andriigrynenko wrote:
> This only checks the first iteration of the loop. Can I do it better with FileCheck ? 
Yes, you can add CHECKs for the second iteration as well.



https://reviews.llvm.org/D24628





More information about the cfe-commits mailing list