Skip to content

[LLDB] Add IsCoreDumping to ProcessInstanceInfo #138580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lldb/include/lldb/Utility/ProcessInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ class ProcessInstanceInfo : public ProcessInfo {

std::optional<bool> 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<bool> IsCoreDumping() const { return m_coredumping; }

void Dump(Stream &s, UserIDResolver &resolver) const;

static void DumpTableHeader(Stream &s, bool show_args, bool verbose);
Expand All @@ -266,6 +271,7 @@ class ProcessInstanceInfo : public ProcessInfo {
struct timespec m_cumulative_system_time;
std::optional<int8_t> m_priority_value = std::nullopt;
std::optional<bool> m_zombie = std::nullopt;
std::optional<bool> m_coredumping = std::nullopt;
};

typedef std::vector<ProcessInstanceInfo> ProcessInstanceInfoList;
Expand Down
5 changes: 5 additions & 0 deletions lldb/source/Host/linux/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions lldb/unittests/Host/posix/HostTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading