[compiler-rt] bcf07ce - [test][sanitizer] FileCheck internal_symbolizer.cpp test output (#67460)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 10:43:30 PDT 2023


Author: Vitaly Buka
Date: 2023-09-26T10:43:26-07:00
New Revision: bcf07ceffa725cc8c7fc5c5b7f5fd674325971d5

URL: https://github.com/llvm/llvm-project/commit/bcf07ceffa725cc8c7fc5c5b7f5fd674325971d5
DIFF: https://github.com/llvm/llvm-project/commit/bcf07ceffa725cc8c7fc5c5b7f5fd674325971d5.diff

LOG: [test][sanitizer] FileCheck internal_symbolizer.cpp test output (#67460)

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/internal_symbolizer.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/internal_symbolizer.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/internal_symbolizer.cpp
index ddfbfdaca8985a4..d4eb300cf3d900b 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/internal_symbolizer.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/internal_symbolizer.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx %s -o %t && %run %t
+// RUN: %clangxx %s -o %t -g && %run %t 2>&1 | FileCheck %s
 
 // REQUIRES: internal_symbolizer
 
@@ -42,13 +42,13 @@ __attribute__((noinline)) void *GetPC() { return __builtin_return_address(0); }
 
 __attribute__((always_inline)) FrameInfo InlineFunction() {
   void *address = GetPC();
-  return {__LINE__ - 1, __FILE__, __FUNCTION__,
+  return {0, "", "",
           reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(address) - 1)};
 }
 
 __attribute__((noinline)) FrameInfo NoInlineFunction() {
   void *address = GetPC();
-  return {__LINE__ - 1, __FILE__, __FUNCTION__,
+  return {0, "", "",
           reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(address) - 1)};
 }
 
@@ -82,8 +82,8 @@ std::string Symbolize(FrameInfo frame) {
   auto modul_offset = GetModuleAndOffset(frame.address);
   char buffer[1024] = {};
   ScopedInSymbolizer in_symbolizer;
-  __sanitizer_symbolize_code(modul_offset.first, modul_offset.second, buffer,
-                             std::size(buffer), true);
+  assert(__sanitizer_symbolize_code(modul_offset.first, modul_offset.second,
+                                    buffer, std::size(buffer), true));
   return buffer;
 }
 
@@ -95,16 +95,24 @@ std::string GetRegex(const FrameInfo &frame) {
 void TestInline() {
   auto frame = InlineFunction();
   fprintf(stderr, "%s: %s\n", __FUNCTION__, Symbolize(frame).c_str());
+  // CHECK-LABEL: TestInline: InlineFunction()
+  // CHECK-NEXT: internal_symbolizer.cpp:[[# @LINE - 55]]
+  // CHECK-NEXT: TestInline()
+  // CHECK-NEXT: internal_symbolizer.cpp:[[# @LINE - 5]]
 }
 
 void TestNoInline() {
   auto frame = NoInlineFunction();
   fprintf(stderr, "%s: %s\n", __FUNCTION__, Symbolize(frame).c_str());
+  // CHECK-LABEL: TestNoInline: NoInlineFunction()
+  // CHECK-NEXT: internal_symbolizer.cpp:[[# @LINE - 58]]
 }
 
 void TestLongFunctionNames() {
   auto frame = A<10>().RecursiveTemplateFunction(0);
   fprintf(stderr, "%s: %s\n", __FUNCTION__, Symbolize(frame).c_str());
+  // CHECK-LABEL: TestLongFunctionNames: NoInlineFunction()
+  // CHECK-NEXT: internal_symbolizer.cpp:[[# @LINE - 65]]
 }
 
 std::string SymbolizeStaticVar() {
@@ -112,13 +120,16 @@ std::string SymbolizeStaticVar() {
   auto modul_offset = GetModuleAndOffset(&var);
   char buffer[1024] = {};
   ScopedInSymbolizer in_symbolizer;
-  __sanitizer_symbolize_data(modul_offset.first, modul_offset.second, buffer,
-                             std::size(buffer));
+  assert(__sanitizer_symbolize_data(modul_offset.first, modul_offset.second,
+                                    buffer, std::size(buffer)));
   return buffer;
 }
 
 void TestData() {
   fprintf(stderr, "%s: %s\n", __FUNCTION__, SymbolizeStaticVar().c_str());
+  // CHECK-LABEL: TestData: SymbolizeStaticVar[abi:cxx11]()::var
+  // CHECK-NEXT: {{[0-9]+ +[0-9]+}}
+  // CHECK-NEXT: internal_symbolizer.cpp:[[# @LINE - 13]]
 }
 
 void TestDemangle() {


        


More information about the llvm-commits mailing list