Skip to content

Commit 6f6eebd

Browse files
committed
Add a test for C-style repr128 enum DWARF debuginfo
1 parent 25c1c63 commit 6f6eebd

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ignore-windows
2+
# This test should be replaced with one in src/test/debuginfo once GDB or LLDB support 128-bit
3+
# enums.
4+
5+
include ../../run-make-fulldeps/tools.mk
6+
7+
all:
8+
$(RUSTC) -Cdebuginfo=2 lib.rs -o $(TMPDIR)/repr128.rlib
9+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128A $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )"
10+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128B $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )"
11+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128C $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 )"
12+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n U128D $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff )"
13+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128A $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 )"
14+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128B $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff )"
15+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128C $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 )"
16+
"$(LLVM_BIN_DIR)"/llvm-dwarfdump -n I128D $(TMPDIR)/repr128.rlib | $(CGREP) "DW_AT_const_value (<0x10> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 7f )"
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![crate_type = "lib"]
2+
#![feature(repr128)]
3+
4+
// Use .to_le() to ensure that the bytes are in the same order on both little- and big-endian
5+
// platforms.
6+
7+
#[repr(u128)]
8+
pub enum U128Enum {
9+
U128A = 0_u128.to_le(),
10+
U128B = 1_u128.to_le(),
11+
U128C = (u64::MAX as u128 + 1).to_le(),
12+
U128D = u128::MAX.to_le(),
13+
}
14+
15+
#[repr(i128)]
16+
pub enum I128Enum {
17+
I128A = 0_i128.to_le(),
18+
I128B = (-1_i128).to_le(),
19+
I128C = i128::MIN.to_le(),
20+
I128D = i128::MAX.to_le(),
21+
}
22+
23+
pub fn f(_: U128Enum, _: I128Enum) {}

0 commit comments

Comments
 (0)