Skip to content

[lldb] Use std::make_shared for StopInfoSP #149612

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 1 commit into from
Jul 18, 2025
Merged
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
37 changes: 19 additions & 18 deletions lldb/source/Target/StopInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,9 @@ class StopInfoWatchpoint : public StopInfo {
// We have to step over the watchpoint before we know what to do:
StopInfoWatchpointSP me_as_siwp_sp
= std::static_pointer_cast<StopInfoWatchpoint>(shared_from_this());
ThreadPlanSP step_over_wp_sp(new ThreadPlanStepOverWatchpoint(
*(thread_sp.get()), me_as_siwp_sp, wp_sp));
ThreadPlanSP step_over_wp_sp =
std::make_shared<ThreadPlanStepOverWatchpoint>(*(thread_sp.get()),
me_as_siwp_sp, wp_sp);
// When this plan is done we want to stop, so set this as a Controlling
// plan.
step_over_wp_sp->SetIsControllingPlan(true);
Expand Down Expand Up @@ -1475,81 +1476,81 @@ StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread,
break_id_t break_id) {
thread.SetThreadHitBreakpointSite();

return StopInfoSP(new StopInfoBreakpoint(thread, break_id));
return std::make_shared<StopInfoBreakpoint>(thread, break_id);
}

StopInfoSP StopInfo::CreateStopReasonWithBreakpointSiteID(Thread &thread,
break_id_t break_id,
bool should_stop) {
return StopInfoSP(new StopInfoBreakpoint(thread, break_id, should_stop));
return std::make_shared<StopInfoBreakpoint>(thread, break_id, should_stop);
}

// LWP_TODO: We'll need a CreateStopReasonWithWatchpointResourceID akin
// to CreateStopReasonWithBreakpointSiteID
StopInfoSP StopInfo::CreateStopReasonWithWatchpointID(Thread &thread,
break_id_t watch_id,
bool silently_continue) {
return StopInfoSP(
new StopInfoWatchpoint(thread, watch_id, silently_continue));
return std::make_shared<StopInfoWatchpoint>(thread, watch_id,
silently_continue);
}

StopInfoSP StopInfo::CreateStopReasonWithSignal(Thread &thread, int signo,
const char *description,
std::optional<int> code) {
thread.GetProcess()->GetUnixSignals()->IncrementSignalHitCount(signo);
return StopInfoSP(new StopInfoUnixSignal(thread, signo, description, code));
return std::make_shared<StopInfoUnixSignal>(thread, signo, description, code);
}

StopInfoSP StopInfo::CreateStopReasonWithInterrupt(Thread &thread, int signo,
const char *description) {
return StopInfoSP(new StopInfoInterrupt(thread, signo, description));
return std::make_shared<StopInfoInterrupt>(thread, signo, description);
}

StopInfoSP StopInfo::CreateStopReasonToTrace(Thread &thread) {
return StopInfoSP(new StopInfoTrace(thread));
return std::make_shared<StopInfoTrace>(thread);
}

StopInfoSP StopInfo::CreateStopReasonWithPlan(
ThreadPlanSP &plan_sp, ValueObjectSP return_valobj_sp,
ExpressionVariableSP expression_variable_sp) {
return StopInfoSP(new StopInfoThreadPlan(plan_sp, return_valobj_sp,
expression_variable_sp));
return std::make_shared<StopInfoThreadPlan>(plan_sp, return_valobj_sp,
expression_variable_sp);
}

StopInfoSP StopInfo::CreateStopReasonWithException(Thread &thread,
const char *description) {
return StopInfoSP(new StopInfoException(thread, description));
return std::make_shared<StopInfoException>(thread, description);
}

StopInfoSP StopInfo::CreateStopReasonProcessorTrace(Thread &thread,
const char *description) {
return StopInfoSP(new StopInfoProcessorTrace(thread, description));
return std::make_shared<StopInfoProcessorTrace>(thread, description);
}

StopInfoSP StopInfo::CreateStopReasonHistoryBoundary(Thread &thread,
const char *description) {
return StopInfoSP(new StopInfoHistoryBoundary(thread, description));
return std::make_shared<StopInfoHistoryBoundary>(thread, description);
}

StopInfoSP StopInfo::CreateStopReasonWithExec(Thread &thread) {
return StopInfoSP(new StopInfoExec(thread));
return std::make_shared<StopInfoExec>(thread);
}

StopInfoSP StopInfo::CreateStopReasonFork(Thread &thread,
lldb::pid_t child_pid,
lldb::tid_t child_tid) {
return StopInfoSP(new StopInfoFork(thread, child_pid, child_tid));
return std::make_shared<StopInfoFork>(thread, child_pid, child_tid);
}


StopInfoSP StopInfo::CreateStopReasonVFork(Thread &thread,
lldb::pid_t child_pid,
lldb::tid_t child_tid) {
return StopInfoSP(new StopInfoVFork(thread, child_pid, child_tid));
return std::make_shared<StopInfoVFork>(thread, child_pid, child_tid);
}

StopInfoSP StopInfo::CreateStopReasonVForkDone(Thread &thread) {
return StopInfoSP(new StopInfoVForkDone(thread));
return std::make_shared<StopInfoVForkDone>(thread);
}

ValueObjectSP StopInfo::GetReturnValueObject(StopInfoSP &stop_info_sp) {
Expand Down
Loading