summaryrefslogtreecommitdiff
path: root/cross-project-tests/debuginfo-tests
diff options
context:
space:
mode:
authorChristian Sigg <csigg@google.com>2022-01-07 22:44:41 +0100
committerChristian Sigg <csigg@google.com>2022-01-08 08:35:51 +0100
commitfb4869e26c80dfc15d44d2c992f1958a1214d183 (patch)
tree50152a20f0185b8d6ea1e65ab438a63adc7b0ec7 /cross-project-tests/debuginfo-tests
parent3e9919cf5750daea501dbe4f1d295afefb5a10cf (diff)
downloadllvm-fb4869e26c80dfc15d44d2c992f1958a1214d183.tar.gz
Fix GDB printers test
- Prevent symbols from being stripped so that it can run with 'RelWithDebInfo'. - Adjust llvm-support CHECKs after code changes. - Polish mlir-support CHECKs as suggested in https://reviews.llvm.org/D116646. Differential Revision: https://reviews.llvm.org/D116837
Diffstat (limited to 'cross-project-tests/debuginfo-tests')
-rw-r--r--cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp19
-rw-r--r--cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb8
-rw-r--r--cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp10
-rw-r--r--cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb91
4 files changed, 71 insertions, 57 deletions
diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
index 07a1a954c4e2..9d08582c45e9 100644
--- a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
+++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
@@ -61,12 +61,15 @@ auto SimpleIlist = []() {
}();
int main() {
- // Reference symbols that might otherwise be stripped.
- ArrayRef[0];
- MutableArrayRef[0];
- (void)!ExpectedValue;
- (void)!ExpectedError;
- *OptionalValue;
- *OptionalNone;
- return 0;
+ std::uintptr_t result = 0;
+ auto dont_strip = [&](const auto &val) {
+ result += reinterpret_cast<std::uintptr_t>(&val);
+ };
+ dont_strip(ArrayRef);
+ dont_strip(MutableArrayRef);
+ dont_strip(ExpectedValue);
+ dont_strip(ExpectedError);
+ dont_strip(OptionalValue);
+ dont_strip(OptionalNone);
+ return result; // Non-zero return value is OK.
}
diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb
index bf7ec5a47f86..eafac583d9f5 100644
--- a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb
+++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb
@@ -64,7 +64,7 @@ set print pretty
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[Node_14]],
-# CHECK: next = [[SimpleIlist_Sentinel:0x.*]] <SimpleIlist>
+# CHECK: next = [[SimpleIlist_Sentinel:0x.*]] <completed>
# CHECK: },
# CHECK: members of IlistNode:
# CHECK: Value = 13
@@ -87,7 +87,7 @@ set print pretty
# CHECK: next = [[Ilist_Sentinel]] <Ilist>
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
-# CHECK: prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
+# CHECK: prev = [[SimpleIlist_Sentinel]] <completed>,
# CHECK: next = [[Node_14]]
# CHECK: },
# CHECK: members of IlistNode:
@@ -103,7 +103,7 @@ p Ilist
# CHECK: next = [[Ilist_Sentinel]] <Ilist>
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
-# CHECK: prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
+# CHECK: prev = [[SimpleIlist_Sentinel]] <completed>,
# CHECK: next = [[Node_14]]
# CHECK: },
# CHECK: members of IlistNode:
@@ -128,7 +128,7 @@ p Ilist
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[Node_14]],
-# CHECK: next = [[SimpleIlist_Sentinel]] <SimpleIlist>
+# CHECK: next = [[SimpleIlist_Sentinel]] <completed>
# CHECK: },
# CHECK: members of IlistNode:
# CHECK: Value = 13
diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
index 28a5cc9cdf1f..e3440b5be09a 100644
--- a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
+++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
@@ -41,4 +41,12 @@ mlir::Attribute StringAttr = mlir::StringAttr::get(&Context, "foo");
mlir::Attribute ElementsAttr = mlir::DenseElementsAttr::get(
VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f});
-int main() { return 0; }
+int main() {
+ // Reference symbols that might otherwise be stripped.
+ std::uintptr_t result = 0;
+ auto dont_strip = [&](const auto &val) {
+ result += reinterpret_cast<std::uintptr_t>(&val);
+ };
+ dont_strip(Value);
+ return result; // Non-zero return value is OK.
+}
diff --git a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb
index de6b5f1e580e..269c24c83ee7 100644
--- a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb
+++ b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.gdb
@@ -24,121 +24,124 @@ print Type
# CHECK-LABEL: +print IndexType
print IndexType
-# CHECK: mlir::IndexType
+# CHECK: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK-LABEL: +print IntegerType
print IntegerType
-# CHECK: mlir::IntegerType
-# CHECK: width = 3
-# CHECK: Unsigned
+# CHECK: typeID = mlir::TypeID::get<mlir::IntegerType>()
+# CHECK: members of mlir::detail::IntegerTypeStorage
# CHECK-LABEL: +print FloatType
print FloatType
-# CHECK: mlir::Float32Type
+# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK-LABEL: +print MemRefType
print MemRefType
-# CHECK: mlir::MemRefType
-# CHECK: shape = llvm::ArrayRef of length 2 = {4, 5}
-# CHECK: elementType
-# CHECK: mlir::Float32Type
+# CHECK: typeID = mlir::TypeID::get<mlir::MemRefType>()
+# CHECK: members of mlir::detail::MemRefTypeStorage
# CHECK-LABEL: +print UnrankedMemRefType
print UnrankedMemRefType
-# CHECK: mlir::UnrankedMemRefType
-# CHECK: elementType
-# CHECK: mlir::IntegerType
-# CHECK: memorySpace
-# CHECK: 6
+# CHECK: typeID = mlir::TypeID::get<mlir::UnrankedMemRefType>()
+# CHECK: members of mlir::detail::UnrankedMemRefTypeStorage
# CHECK-LABEL: +print VectorType
print VectorType
-# CHECK: mlir::VectorType
-# CHECK: shape = llvm::ArrayRef of length 2 = {1, 2}
+# CHECK: typeID = mlir::TypeID::get<mlir::VectorType>()
+# CHECK: members of mlir::detail::VectorTypeStorage
# CHECK-LABEL: +print TupleType
print TupleType
-# CHECK: mlir::TupleType
-# CHECK: numElements = 2
+# CHECK: typeID = mlir::TypeID::get<mlir::TupleType>()
# CHECK: elements[0]
-# CHECK: mlir::IndexType
+# CHECK-NEXT: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK: elements[1]
-# CHECK: mlir::Float32Type
+# CHECK-NEXT: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK-LABEL: +print Result
print Result
-# CHECK: mlir::Float32Type
+# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK: outOfLineIndex = 42
# CHECK-LABEL: +print Value
print Value
-# CHECK: OutOfLineOpResult
+# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
+# CHECK: mlir::detail::ValueImpl::Kind::OutOfLineOpResult
# CHECK-LABEL: +print UnknownLoc
print UnknownLoc
-# CHECK: mlir::UnknownLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::UnknownLoc>()
# CHECK-LABEL: +print FileLineColLoc
print FileLineColLoc
-# CHECK: mlir::FileLineColLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
+# CHECK: members of mlir::detail::FileLineColLocAttrStorage
# CHECK: "file"
# CHECK: line = 7
# CHECK: column = 8
# CHECK-LABEL: +print OpaqueLoc
print OpaqueLoc
-# CHECK: mlir::OpaqueLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::OpaqueLoc>()
+# CHECK: members of mlir::detail::OpaqueLocAttrStorage
# CHECK: underlyingLocation = 9
# CHECK-LABEL: +print NameLoc
print NameLoc
-# CHECK: mlir::NameLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::NameLoc>()
+# CHECK: members of mlir::detail::NameLocAttrStorage
# CHECK: "foo"
-# CHECK: mlir::UnknownLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::UnknownLoc>()
# CHECK-LABEL: +print CallSiteLoc
print CallSiteLoc
-# CHECK: mlir::CallSiteLoc
-# CHECK: callee
-# CHECK: mlir::FileLineColLoc
-# CHECK: caller
-# CHECK: mlir::OpaqueLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::CallSiteLoc>()
+# CHECK: members of mlir::detail::CallSiteLocAttrStorage
+# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
+# CHECK: typeID = mlir::TypeID::get<mlir::OpaqueLoc>()
# CHECK-LABEL: +print FusedLoc
print FusedLoc
-# CHECK: mlir::FusedLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::FusedLoc>()
+# CHECK: members of mlir::detail::FusedLocAttrStorage
# CHECK: locations = llvm::ArrayRef of length 2
-# CHECK: mlir::FileLineColLoc
-# CHECK: mlir::NameLoc
+# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
+# CHECK: typeID = mlir::TypeID::get<mlir::NameLoc>()
# CHECK-LABEL: +print UnitAttr
print UnitAttr
-# CHECK: mlir::UnitAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::UnitAttr>()
# CHECK-LABEL: +print FloatAttr
print FloatAttr
-# CHECK: mlir::FloatAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::FloatAttr>()
+# CHECK: members of mlir::detail::FloatAttrStorage
# CHECK-LABEL: +print IntegerAttr
print IntegerAttr
-# CHECK: mlir::IntegerAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::IntegerAttr>()
+# CHECK: members of mlir::detail::IntegerAttrStorage
# CHECK-LABEL: +print TypeAttr
print TypeAttr
-# CHECK: mlir::TypeAttr
-# CHECK: mlir::IndexType
+# CHECK: typeID = mlir::TypeID::get<mlir::TypeAttr>()
+# CHECK: members of mlir::detail::TypeAttrStorage
+# CHECK: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK-LABEL: +print ArrayAttr
print ArrayAttr
-# CHECK: mlir::ArrayAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::ArrayAttr>()
+# CHECK: members of mlir::detail::ArrayAttrStorage
# CHECK: llvm::ArrayRef of length 1
-# CHECK: mlir::UnitAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::UnitAttr>()
# CHECK-LABEL: +print StringAttr
print StringAttr
-# CHECK: mlir::StringAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::StringAttr>()
+# CHECK: members of mlir::detail::StringAttrStorage
# CHECK: value = "foo"
# CHECK-LABEL: +print ElementsAttr
print ElementsAttr
-# CHECK: mlir::DenseIntOrFPElementsAttr
+# CHECK: typeID = mlir::TypeID::get<mlir::DenseIntOrFPElementsAttr>()
+# CHECK: members of mlir::detail::DenseIntOrFPElementsAttrStorage