[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Michael Buch via lldb-commits


@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \

Michael137 wrote:

good catch, removed

https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/96932

>From d2c28706769f89bf9f0b53071726bb59c6205ce8 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 27 Jun 2024 17:16:50 +0100
Subject: [PATCH 1/2] [lldb][test] Add test-cases for packed structures

Adds test that checks whether LLDB correctly infers the
alignment of packed structures. Specifically, the
`InferAlignment` code-path of the `ItaniumRecordLayoutBuilder`
where it assumes that overlapping field offsets imply a
packed structure and thus sets alignment to `1`. See discussion
in https://github.com/llvm/llvm-project/pull/93809.

While here, also added a test-case where we check alignment of
a class whose base has an explicit `DW_AT_alignment
(those don't get transitively propagated in DWARF, but don't seem
like a problem for LLDB).

Lastly, also added an XFAIL-ed tests where the aforementioned
`InferAlignment` kicks in for overlapping fields (but in this
case incorrectly since the structure isn't actually packed).
---
 .../TestAlignAsBaseClass.py   |  1 +
 .../API/lang/cpp/alignas_base_class/main.cpp  |  7 
 .../DWARF/no_unique_address-alignment.cpp | 25 +
 lldb/test/Shell/SymbolFile/DWARF/packed.cpp   | 36 +++
 4 files changed, 69 insertions(+)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/packed.cpp

diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index 7d97b0c42b7e1..362fc2740bf52 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -16,3 +16,4 @@ def test(self):
 # Verify specified class alignments.
 self.expect_expr("alignof(B2)", result_value="8")
 self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
+self.expect_expr("alignof(Derived)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 9d37554957ba3..a37919deaebdc 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -13,4 +13,11 @@ D d3g;
 struct alignas(8) EmptyClassAlign8 {
 } t;
 
+struct alignas(8) __attribute__((packed)) AlignedAndPackedBase {
+} foo;
+
+struct Derived : AlignedAndPackedBase {
+} bar;
+static_assert(alignof(Derived) == 8);
+
 int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
new file mode 100644
index 0..6e544f40625df
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(OverlappingFields)" \
+// RUN:   -o "expr sizeof(OverlappingFields)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 4
+// CHECK:  (lldb) expr sizeof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 8
+
+struct Empty {};
+
+struct OverlappingFields {
+  char y;
+  [[no_unique_address]] Empty e;
+  int z;
+} g_packed_struct;
+static_assert(alignof(OverlappingFields) == 4);
+static_assert(sizeof(OverlappingFields) == 8);
+
+int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
new file mode 100644
index 0..fb94a834d48a6
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
@@ -0,0 +1,36 @@
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(packed)" \
+// RUN:   -o "expr sizeof(packed)" \
+// RUN:   -o "expr alignof(packed_and_aligned)" \
+// RUN:   -o "expr sizeof(packed_and_aligned)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(packed)
+// CHECK-NEXT: ${{.*}} = 1
+// CHECK:  (lldb) expr sizeof(packed)
+// CHECK-NEXT: ${{.*}} = 9
+
+// CHECK:  (lldb) expr alignof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+// CHECK:  (lldb) expr sizeof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+
+struct __attribute__((packed)) packed {
+  int x;
+  char y;
+  int z;
+} g_packed_struct;
+static_assert(alignof(packed) == 1);
+static_assert(sizeof(packed) == 9);
+
+struct __attribute__((packed, aligned(16))) packed_and_aligned {
+  int x;
+  char y;
+  int z;
+} g_packed_and_aligned_struct;
+static_assert(alignof(packed_and_aligned) == 16);
+static_assert(sizeof(packed_and_aligned) == 16);
+
+int main() {}

>From a7b91858c8f9e09b455a581469155152f2dea11e Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 28 Jun 2024 09:08:20 +0100
Subject: [PATCH 2/2] fixup! don't set redundant 

[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \

labath wrote:

It looks like you're not actually running the binary. Do you need the 
breakpoint?

https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,36 @@
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \

labath wrote:

same here

https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Pavel Labath via lldb-commits

https://github.com/labath approved this pull request.


https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-28 Thread Pavel Labath via lldb-commits

https://github.com/labath edited https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-27 Thread Michael Buch via lldb-commits

https://github.com/Michael137 edited 
https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-27 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/96932

>From d2c28706769f89bf9f0b53071726bb59c6205ce8 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 27 Jun 2024 17:16:50 +0100
Subject: [PATCH] [lldb][test] Add test-cases for packed structures

Adds test that checks whether LLDB correctly infers the
alignment of packed structures. Specifically, the
`InferAlignment` code-path of the `ItaniumRecordLayoutBuilder`
where it assumes that overlapping field offsets imply a
packed structure and thus sets alignment to `1`. See discussion
in https://github.com/llvm/llvm-project/pull/93809.

While here, also added a test-case where we check alignment of
a class whose base has an explicit `DW_AT_alignment
(those don't get transitively propagated in DWARF, but don't seem
like a problem for LLDB).

Lastly, also added an XFAIL-ed tests where the aforementioned
`InferAlignment` kicks in for overlapping fields (but in this
case incorrectly since the structure isn't actually packed).
---
 .../TestAlignAsBaseClass.py   |  1 +
 .../API/lang/cpp/alignas_base_class/main.cpp  |  7 
 .../DWARF/no_unique_address-alignment.cpp | 25 +
 lldb/test/Shell/SymbolFile/DWARF/packed.cpp   | 36 +++
 4 files changed, 69 insertions(+)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/packed.cpp

diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index 7d97b0c42b7e1..362fc2740bf52 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -16,3 +16,4 @@ def test(self):
 # Verify specified class alignments.
 self.expect_expr("alignof(B2)", result_value="8")
 self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
+self.expect_expr("alignof(Derived)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 9d37554957ba3..a37919deaebdc 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -13,4 +13,11 @@ D d3g;
 struct alignas(8) EmptyClassAlign8 {
 } t;
 
+struct alignas(8) __attribute__((packed)) AlignedAndPackedBase {
+} foo;
+
+struct Derived : AlignedAndPackedBase {
+} bar;
+static_assert(alignof(Derived) == 8);
+
 int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
new file mode 100644
index 0..6e544f40625df
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(OverlappingFields)" \
+// RUN:   -o "expr sizeof(OverlappingFields)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 4
+// CHECK:  (lldb) expr sizeof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 8
+
+struct Empty {};
+
+struct OverlappingFields {
+  char y;
+  [[no_unique_address]] Empty e;
+  int z;
+} g_packed_struct;
+static_assert(alignof(OverlappingFields) == 4);
+static_assert(sizeof(OverlappingFields) == 8);
+
+int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
new file mode 100644
index 0..fb94a834d48a6
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
@@ -0,0 +1,36 @@
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(packed)" \
+// RUN:   -o "expr sizeof(packed)" \
+// RUN:   -o "expr alignof(packed_and_aligned)" \
+// RUN:   -o "expr sizeof(packed_and_aligned)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(packed)
+// CHECK-NEXT: ${{.*}} = 1
+// CHECK:  (lldb) expr sizeof(packed)
+// CHECK-NEXT: ${{.*}} = 9
+
+// CHECK:  (lldb) expr alignof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+// CHECK:  (lldb) expr sizeof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+
+struct __attribute__((packed)) packed {
+  int x;
+  char y;
+  int z;
+} g_packed_struct;
+static_assert(alignof(packed) == 1);
+static_assert(sizeof(packed) == 9);
+
+struct __attribute__((packed, aligned(16))) packed_and_aligned {
+  int x;
+  char y;
+  int z;
+} g_packed_and_aligned_struct;
+static_assert(alignof(packed_and_aligned) == 16);
+static_assert(sizeof(packed_and_aligned) == 16);
+
+int main() {}

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-27 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

Adds test that checks that LLDB correctly infers the alignment of packed 
structures. Specifically, the
`InferAlignment` code-path of the `ItaniumRecordLayoutBuilder` where it assumes 
that overlapping field offsets imply a packed structure and thus sets alignment 
to `1`. See discussion in https://github.com/llvm/llvm-project/pull/93809.

Also adds two XFAIL-ed tests:
1. where LLDB doesn't correctly infer the alignment of a derived class whose 
base has an explicit `DW_AT_alignment. See 
https://github.com/llvm/llvm-project/issues/73623.
2. where the aforementioned `InferAlignment` kicks in for overlapping fields 
(but in this case incorrectly since the structure isn't actually packed).

---
Full diff: https://github.com/llvm/llvm-project/pull/96932.diff


4 Files Affected:

- (modified) lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
(+8) 
- (modified) lldb/test/API/lang/cpp/alignas_base_class/main.cpp (+6) 
- (added) lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp 
(+25) 
- (added) lldb/test/Shell/SymbolFile/DWARF/packed.cpp (+36) 


``diff
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index 7d97b0c42b7e1..f9c99d15e5891 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -16,3 +16,11 @@ def test(self):
 # Verify specified class alignments.
 self.expect_expr("alignof(B2)", result_value="8")
 self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
+
+@no_debug_info_test
+
@expectedFailureAll(bugnumber="https://github.com/llvm/llvm-project/issues/73623;)
+def test(self):
+self.build()
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+self.expect_expr("alignof(Derived)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 9d37554957ba3..fb922c42edfc3 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -13,4 +13,10 @@ D d3g;
 struct alignas(8) EmptyClassAlign8 {
 } t;
 
+struct alignas(8) __attribute__((packed)) AlignedAndPackedBase {} foo;
+
+struct Derived : AlignedAndPackedBase {
+} bar;
+static_assert(alignof(Derived) == 8);
+
 int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
new file mode 100644
index 0..79199a9237a63
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(OverlappingFields)" \
+// RUN:   -o "expr sizeof(OverlappingFields)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 4
+// CHECK:  (lldb) expr sizeof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 8
+
+struct Empty {};
+
+struct OverlappingFields {
+char y;
+[[no_unique_address]] Empty e;
+int z;
+} g_packed_struct;
+static_assert(alignof(OverlappingFields) == 4);
+static_assert(sizeof(OverlappingFields) == 8);
+
+int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
new file mode 100644
index 0..53b5ee624472c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
@@ -0,0 +1,36 @@
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(packed)" \
+// RUN:   -o "expr sizeof(packed)" \
+// RUN:   -o "expr alignof(packed_and_aligned)" \
+// RUN:   -o "expr sizeof(packed_and_aligned)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(packed)
+// CHECK-NEXT: ${{.*}} = 1
+// CHECK:  (lldb) expr sizeof(packed)
+// CHECK-NEXT: ${{.*}} = 9
+
+// CHECK:  (lldb) expr alignof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+// CHECK:  (lldb) expr sizeof(packed_and_aligned)
+// CHECK-NEXT: ${{.*}} = 16
+
+struct __attribute__((packed)) packed {
+int x;
+char y;
+int z;
+} g_packed_struct;
+static_assert(alignof(packed) == 1);
+static_assert(sizeof(packed) == 9);
+
+struct __attribute__((packed, aligned(16))) packed_and_aligned {
+int x;
+char y;
+int z;
+} g_packed_and_aligned_struct;
+static_assert(alignof(packed_and_aligned) == 16);
+static_assert(sizeof(packed_and_aligned) == 16);
+
+int main() {}

``




https://github.com/llvm/llvm-project/pull/96932
___
lldb-commits mailing list
lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] [lldb][test] Add test-cases for packed/aligned structures (PR #96932)

2024-06-27 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/96932

Adds test that checks that LLDB correctly infers the alignment of packed 
structures. Specifically, the
`InferAlignment` code-path of the `ItaniumRecordLayoutBuilder` where it assumes 
that overlapping field offsets imply a packed structure and thus sets alignment 
to `1`. See discussion in https://github.com/llvm/llvm-project/pull/93809.

Also adds two XFAIL-ed tests:
1. where LLDB doesn't correctly infer the alignment of a derived class whose 
base has an explicit `DW_AT_alignment. See 
https://github.com/llvm/llvm-project/issues/73623.
2. where the aforementioned `InferAlignment` kicks in for overlapping fields 
(but in this case incorrectly since the structure isn't actually packed).

>From 2113f052dd69cc1773f642e06339e5a13599090c Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Thu, 27 Jun 2024 17:16:50 +0100
Subject: [PATCH] [lldb][test] Add test-cases for packed structures

Adds test that checks that LLDB correctly infers the
alignment of packed structures. Specifically, the
`InferAlignment` code-path of the `ItaniumRecordLayoutBuilder`
where it assumes that overlapping field offsets imply a
packed structure and thus sets alignment to `1`. See discussion
in https://github.com/llvm/llvm-project/pull/93809.

Also adds two XFAIL-ed tests:
1. where LLDB doesn't correctly infer the alignment of a derived class whose 
base has
an explicit `DW_AT_alignment. See 
https://github.com/llvm/llvm-project/issues/73623.
2. where the aforementioned `InferAlignment` kicks in for
   overlapping fields (but in this case incorrectly since
   the structure isn't actually packed).
---
 .../TestAlignAsBaseClass.py   |  8 +
 .../API/lang/cpp/alignas_base_class/main.cpp  |  6 
 .../DWARF/no_unique_address-alignment.cpp | 25 +
 lldb/test/Shell/SymbolFile/DWARF/packed.cpp   | 36 +++
 4 files changed, 75 insertions(+)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/packed.cpp

diff --git a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
index 7d97b0c42b7e1..f9c99d15e5891 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
+++ b/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -16,3 +16,11 @@ def test(self):
 # Verify specified class alignments.
 self.expect_expr("alignof(B2)", result_value="8")
 self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
+
+@no_debug_info_test
+
@expectedFailureAll(bugnumber="https://github.com/llvm/llvm-project/issues/73623;)
+def test(self):
+self.build()
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+self.expect_expr("alignof(Derived)", result_value="8")
diff --git a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp 
b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
index 9d37554957ba3..fb922c42edfc3 100644
--- a/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
+++ b/lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -13,4 +13,10 @@ D d3g;
 struct alignas(8) EmptyClassAlign8 {
 } t;
 
+struct alignas(8) __attribute__((packed)) AlignedAndPackedBase {} foo;
+
+struct Derived : AlignedAndPackedBase {
+} bar;
+static_assert(alignof(Derived) == 8);
+
 int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
new file mode 100644
index 0..79199a9237a63
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-alignment.cpp
@@ -0,0 +1,25 @@
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(OverlappingFields)" \
+// RUN:   -o "expr sizeof(OverlappingFields)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb) expr alignof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 4
+// CHECK:  (lldb) expr sizeof(OverlappingFields)
+// CHECK-NEXT: ${{.*}} = 8
+
+struct Empty {};
+
+struct OverlappingFields {
+char y;
+[[no_unique_address]] Empty e;
+int z;
+} g_packed_struct;
+static_assert(alignof(OverlappingFields) == 4);
+static_assert(sizeof(OverlappingFields) == 8);
+
+int main() {}
diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
new file mode 100644
index 0..53b5ee624472c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp
@@ -0,0 +1,36 @@
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "b main" \
+// RUN:   -o "expr alignof(packed)" \
+// RUN:   -o "expr sizeof(packed)" \
+// RUN:   -o "expr alignof(packed_and_aligned)" \
+// RUN:   -o "expr sizeof(packed_and_aligned)" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:  (lldb)