diff --git a/lldb/include/lldb/Utility/ProcessInfo.h b/lldb/include/lldb/Utility/ProcessInfo.h index 78ade4bbb1ee6..24041faad80bf 100644 --- a/lldb/include/lldb/Utility/ProcessInfo.h +++ b/lldb/include/lldb/Utility/ProcessInfo.h @@ -247,6 +247,11 @@ class ProcessInstanceInfo : public ProcessInfo { std::optional IsZombie() const { return m_zombie; } + // proc/../status specifies CoreDumping as the field + // so we match the case here. + void SetIsCoreDumping(bool is_coredumping) { m_coredumping = is_coredumping; } + std::optional IsCoreDumping() const { return m_coredumping; } + void Dump(Stream &s, UserIDResolver &resolver) const; static void DumpTableHeader(Stream &s, bool show_args, bool verbose); @@ -266,6 +271,7 @@ class ProcessInstanceInfo : public ProcessInfo { struct timespec m_cumulative_system_time; std::optional m_priority_value = std::nullopt; std::optional m_zombie = std::nullopt; + std::optional m_coredumping = std::nullopt; }; typedef std::vector ProcessInstanceInfoList; diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index 8b475a7ab5003..b5f050426d88b 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -213,6 +213,11 @@ static bool GetStatusInfo(::pid_t Pid, ProcessInstanceInfo &ProcessInfo, } else if (Line.consume_front("Tgid:")) { Line = Line.ltrim(); Line.consumeInteger(10, Tgid); + } else if (Line.consume_front("CoreDumping:")) { + uint32_t coredumping; + Line = Line.ltrim(); + if (!Line.consumeInteger(2, coredumping)) + ProcessInfo.SetIsCoreDumping(coredumping); } } return true; diff --git a/lldb/unittests/Host/posix/HostTest.cpp b/lldb/unittests/Host/posix/HostTest.cpp index 5d50de3524d1e..082edccf4e774 100644 --- a/lldb/unittests/Host/posix/HostTest.cpp +++ b/lldb/unittests/Host/posix/HostTest.cpp @@ -115,5 +115,8 @@ 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()); } #endif