[Lldb-commits] [lldb] [lldb][test] check if CoreDumping is supported at runtime (PR #161385)
Daniel Thornburgh via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 3 16:12:13 PDT 2025
https://github.com/mysterymath updated https://github.com/llvm/llvm-project/pull/161385
>From bbc894aab1a2c58611b84025362422f5aa0821ac Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Tue, 30 Sep 2025 14:22:55 +0100
Subject: [PATCH 1/4] Revert "[lldb][test] check if CoreDumping info is
supported (#160333)"
This reverts commit 02d8fb5789f64ed9cff3f42b005105a51c6c7550.
---
lldb/unittests/Host/posix/HostTest.cpp | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index dc75b288ba76a..082edccf4e774 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -15,10 +15,6 @@
#include <cerrno>
#include <sys/resource.h>
-#ifdef __linux__
-#include <linux/version.h>
-#endif // __linux__
-
using namespace lldb_private;
namespace {
@@ -120,12 +116,7 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
ASSERT_TRUE(Info.IsZombie().has_value());
ASSERT_FALSE(Info.IsZombie().value());
- // CoreDumping was added in kernel version 4.15.
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
ASSERT_TRUE(Info.IsCoreDumping().has_value());
ASSERT_FALSE(Info.IsCoreDumping().value());
-#else
- ASSERT_FALSE(Info.IsCoreDumping().has_value());
-#endif
}
#endif
>From 598ac332a7446cf4c42c22b38c76f6b6a52ca4e9 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Wed, 1 Oct 2025 12:28:42 +0100
Subject: [PATCH 2/4] [lldb][test] check if CoreDumping is supported at runtime
---
lldb/unittests/Host/posix/HostTest.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index 082edccf4e774..40a1d518a0d6d 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -116,7 +116,14 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
ASSERT_TRUE(Info.IsZombie().has_value());
ASSERT_FALSE(Info.IsZombie().value());
- ASSERT_TRUE(Info.IsCoreDumping().has_value());
- ASSERT_FALSE(Info.IsCoreDumping().value());
+ const llvm::VersionTuple host_version = HostInfo::GetOSVersion();
+ if (!host_version.empty()) {
+ if (host_version >= llvm::VersionTuple(4, 15, 0)) {
+ ASSERT_TRUE(Info.IsCoreDumping().has_value());
+ ASSERT_FALSE(Info.IsCoreDumping().value());
+ } else {
+ ASSERT_FALSE(Info.IsCoreDumping().has_value());
+ }
+ }
}
#endif
>From ff52be6dd79febf8d23adb9b3a6120dc3364c5cf Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Wed, 1 Oct 2025 14:08:52 +0100
Subject: [PATCH 3/4] Update lldb/unittests/Host/posix/HostTest.cpp
Co-authored-by: Michael Buch <michaelbuch12 at gmail.com>
---
lldb/unittests/Host/posix/HostTest.cpp | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index 40a1d518a0d6d..0b0eb99bf573c 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -117,13 +117,12 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
ASSERT_FALSE(Info.IsZombie().value());
const llvm::VersionTuple host_version = HostInfo::GetOSVersion();
- if (!host_version.empty()) {
- if (host_version >= llvm::VersionTuple(4, 15, 0)) {
- ASSERT_TRUE(Info.IsCoreDumping().has_value());
- ASSERT_FALSE(Info.IsCoreDumping().value());
- } else {
- ASSERT_FALSE(Info.IsCoreDumping().has_value());
- }
+ ASSERT_TRUE(host_version);
+ if (host_version >= llvm::VersionTuple(4, 15, 0)) {
+ ASSERT_TRUE(Info.IsCoreDumping().has_value());
+ ASSERT_FALSE(Info.IsCoreDumping().value());
+ } else {
+ ASSERT_FALSE(Info.IsCoreDumping().has_value());
}
}
#endif
>From 72212a1bd218e350256b140006338141f1f85b6d Mon Sep 17 00:00:00 2001
From: Daniel Thornburgh <mysterymath at gmail.com>
Date: Fri, 3 Oct 2025 16:12:03 -0700
Subject: [PATCH 4/4] Update HostTest.cpp
Correct typo
---
lldb/unittests/Host/posix/HostTest.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp
index 0b0eb99bf573c..7135f266a3507 100644
--- a/lldb/unittests/Host/posix/HostTest.cpp
+++ b/lldb/unittests/Host/posix/HostTest.cpp
@@ -117,7 +117,7 @@ TEST_F(HostTest, GetProcessInfoSetsPriority) {
ASSERT_FALSE(Info.IsZombie().value());
const llvm::VersionTuple host_version = HostInfo::GetOSVersion();
- ASSERT_TRUE(host_version);
+ ASSERT_FALSE(host_version.empty());
if (host_version >= llvm::VersionTuple(4, 15, 0)) {
ASSERT_TRUE(Info.IsCoreDumping().has_value());
ASSERT_FALSE(Info.IsCoreDumping().value());
More information about the lldb-commits
mailing list