Skip to content

Commit 391cdfd

Browse files
author
git apple-llvm automerger
committed
Merge commit '02d3a799e7eb' from llvm.org/main into next
2 parents ccd5749 + 02d3a79 commit 391cdfd

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

lldb/include/lldb/Target/Process.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,6 +3244,8 @@ void PruneThreadPlans();
32443244
Status LaunchPrivate(ProcessLaunchInfo &launch_info, lldb::StateType &state,
32453245
lldb::EventSP &event_sp);
32463246

3247+
lldb::EventSP CreateEventFromProcessState(uint32_t event_type);
3248+
32473249
Process(const Process &) = delete;
32483250
const Process &operator=(const Process &) = delete;
32493251
};

lldb/include/lldb/Utility/Broadcaster.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ class Broadcaster {
181181
m_broadcaster_sp->BroadcastEvent(event_type);
182182
}
183183

184-
void BroadcastEventIfUnique(uint32_t event_type,
185-
EventData *event_data = nullptr) {
186-
m_broadcaster_sp->BroadcastEventIfUnique(event_type, event_data);
184+
void BroadcastEventIfUnique(uint32_t event_type) {
185+
m_broadcaster_sp->BroadcastEventIfUnique(event_type);
187186
}
188187

189188
void Clear() { m_broadcaster_sp->Clear(); }
@@ -351,8 +350,7 @@ class Broadcaster {
351350
void BroadcastEvent(uint32_t event_type,
352351
const lldb::EventDataSP &event_data_sp);
353352

354-
void BroadcastEventIfUnique(uint32_t event_type,
355-
EventData *event_data = nullptr);
353+
void BroadcastEventIfUnique(uint32_t event_type);
356354

357355
void Clear();
358356

lldb/source/Target/Process.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,25 +4429,31 @@ void Process::CalculateExecutionContext(ExecutionContext &exe_ctx) {
44294429
// return Host::GetArchSpecForExistingProcess (process_name);
44304430
//}
44314431

4432+
EventSP Process::CreateEventFromProcessState(uint32_t event_type) {
4433+
auto event_data_sp =
4434+
std::make_shared<ProcessEventData>(shared_from_this(), GetState());
4435+
return std::make_shared<Event>(event_type, event_data_sp);
4436+
}
4437+
44324438
void Process::AppendSTDOUT(const char *s, size_t len) {
44334439
std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
44344440
m_stdout_data.append(s, len);
4435-
BroadcastEventIfUnique(eBroadcastBitSTDOUT,
4436-
new ProcessEventData(shared_from_this(), GetState()));
4441+
auto event_sp = CreateEventFromProcessState(eBroadcastBitSTDOUT);
4442+
BroadcastEventIfUnique(event_sp);
44374443
}
44384444

44394445
void Process::AppendSTDERR(const char *s, size_t len) {
44404446
std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
44414447
m_stderr_data.append(s, len);
4442-
BroadcastEventIfUnique(eBroadcastBitSTDERR,
4443-
new ProcessEventData(shared_from_this(), GetState()));
4448+
auto event_sp = CreateEventFromProcessState(eBroadcastBitSTDERR);
4449+
BroadcastEventIfUnique(event_sp);
44444450
}
44454451

44464452
void Process::BroadcastAsyncProfileData(const std::string &one_profile_data) {
44474453
std::lock_guard<std::recursive_mutex> guard(m_profile_data_comm_mutex);
44484454
m_profile_data.push_back(one_profile_data);
4449-
BroadcastEventIfUnique(eBroadcastBitProfileData,
4450-
new ProcessEventData(shared_from_this(), GetState()));
4455+
auto event_sp = CreateEventFromProcessState(eBroadcastBitProfileData);
4456+
BroadcastEventIfUnique(event_sp);
44514457
}
44524458

44534459
void Process::BroadcastStructuredData(const StructuredData::ObjectSP &object_sp,

lldb/source/Utility/Broadcaster.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,8 @@ void Broadcaster::BroadcasterImpl::BroadcastEvent(
311311
PrivateBroadcastEvent(event_sp, false);
312312
}
313313

314-
void Broadcaster::BroadcasterImpl::BroadcastEventIfUnique(
315-
uint32_t event_type, EventData *event_data) {
316-
auto event_sp = std::make_shared<Event>(event_type, event_data);
314+
void Broadcaster::BroadcasterImpl::BroadcastEventIfUnique(uint32_t event_type) {
315+
auto event_sp = std::make_shared<Event>(event_type, /*data = */ nullptr);
317316
PrivateBroadcastEvent(event_sp, true);
318317
}
319318

0 commit comments

Comments
 (0)