about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorJulia Tatz <tatz.j@northeastern.edu>2021-04-06 16:00:35 -0400
committerJynn Nelson <jyn.nelson@redjack.com>2023-03-31 07:28:39 -0400
commit0504a333837e10f19454901fd060c0f99bf8f5b7 (patch)
tree2e398745b33d84894ee367bf07d77bdc14e075fc /tests/codegen
parenteb3e9c1f45981b47160543cfd882ca00e69bbfab (diff)
downloadrust-0504a333837e10f19454901fd060c0f99bf8f5b7.tar.gz
rust-0504a333837e10f19454901fd060c0f99bf8f5b7.zip
Preserve, clarify, and extend debug information
`-Cdebuginfo=1` was never line tables only and
can't be due to backwards compatibility issues.
This was clarified and an option for line tables only
was added. Additionally an option for line info
directives only was added, which is well needed for
some targets. The debug info options should now
behave the same as clang's debug info options.
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/debug-limited.rs28
-rw-r--r--tests/codegen/debug-line-directives-only.rs28
-rw-r--r--tests/codegen/debug-line-tables-only.rs28
3 files changed, 84 insertions, 0 deletions
diff --git a/tests/codegen/debug-limited.rs b/tests/codegen/debug-limited.rs
new file mode 100644
index 00000000000..fafee0ef583
--- /dev/null
+++ b/tests/codegen/debug-limited.rs
@@ -0,0 +1,28 @@
+// Verify that the limited debuginfo option emits llvm's FullDebugInfo, but no type info.
+//
+// ignore-windows
+// compile-flags: -C debuginfo=limited
+
+#[repr(C)]
+struct StructType {
+    a: i64,
+    b: i32
+}
+
+extern "C" {
+    fn creator() -> *mut StructType;
+    fn save(p: *const StructType);
+}
+
+fn main() {
+    unsafe {
+        let value: &mut StructType = &mut* creator();
+        value.a = 7;
+        save(value as *const StructType)
+    }
+}
+
+// CHECK: !DICompileUnit
+// CHECK: emissionKind: FullDebug
+// CHECK: !DILocation
+// CHECK-NOT: !DIBasicType
diff --git a/tests/codegen/debug-line-directives-only.rs b/tests/codegen/debug-line-directives-only.rs
new file mode 100644
index 00000000000..0dd22931b30
--- /dev/null
+++ b/tests/codegen/debug-line-directives-only.rs
@@ -0,0 +1,28 @@
+// Verify that the only debuginfo generated are the line directives.
+//
+// ignore-windows
+// compile-flags: -C debuginfo=line-directives-only
+
+#[repr(C)]
+struct StructType {
+    a: i64,
+    b: i32
+}
+
+extern "C" {
+    fn creator() -> *mut StructType;
+    fn save(p: *const StructType);
+}
+
+fn main() {
+    unsafe {
+        let value: &mut StructType = &mut* creator();
+        value.a = 7;
+        save(value as *const StructType)
+    }
+}
+
+// CHECK: !DICompileUnit
+// CHECK: emissionKind: DebugDirectivesOnly
+// CHECK: !DILocation
+// CHECK-NOT: !DIBasicType
diff --git a/tests/codegen/debug-line-tables-only.rs b/tests/codegen/debug-line-tables-only.rs
new file mode 100644
index 00000000000..3d109d4ae51
--- /dev/null
+++ b/tests/codegen/debug-line-tables-only.rs
@@ -0,0 +1,28 @@
+// Verify that the only debuginfo generated are the line tables.
+//
+// ignore-windows
+// compile-flags: -C debuginfo=line-tables-only
+
+#[repr(C)]
+struct StructType {
+    a: i64,
+    b: i32
+}
+
+extern "C" {
+    fn creator() -> *mut StructType;
+    fn save(p: *const StructType);
+}
+
+fn main() {
+    unsafe {
+        let value: &mut StructType = &mut* creator();
+        value.a = 7;
+        save(value as *const StructType)
+    }
+}
+
+// CHECK: !DICompileUnit
+// CHECK: emissionKind: LineTablesOnly
+// CHECK: !DILocation
+// CHECK-NOT: !DIBasicType