@@ -820,6 +820,31 @@ static bool AnyDebuggerCausedStop(ThreadList &thread_list) {
820
820
return false ;
821
821
}
822
822
823
+ // / Returns true if curr_thread is not null and it is stopped at a REPL
824
+ // / breakpoint.
825
+ static bool IsREPLBreakpoint (Thread *curr_thread) {
826
+ if (!curr_thread)
827
+ return false ;
828
+
829
+ Process &process = *curr_thread->GetProcess ();
830
+
831
+ if (StopInfoSP stop_info_sp = curr_thread->GetStopInfo ())
832
+ if (BreakpointSiteSP bp_site_sp =
833
+ process.GetBreakpointSiteList ().FindByID (stop_info_sp->GetValue ()))
834
+ return BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
835
+
836
+ // Only check the breakpoint site for the current PC if the stop reason didn't
837
+ // have a valid breakpoint site.
838
+ if (StackFrameSP frame_sp = curr_thread->GetStackFrameAtIndex (0 )) {
839
+ if (BreakpointSiteSP bp_site_sp =
840
+ process.GetBreakpointSiteList ().FindByAddress (
841
+ frame_sp->GetStackID ().GetPC ()))
842
+ return BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
843
+ }
844
+
845
+ return false ;
846
+ }
847
+
823
848
bool Process::HandleProcessStateChangedEvent (
824
849
const EventSP &event_sp, Stream *stream,
825
850
SelectMostRelevant select_most_relevant,
@@ -906,7 +931,6 @@ bool Process::HandleProcessStateChangedEvent(
906
931
}
907
932
} else {
908
933
bool check_for_repl_breakpoint = false ;
909
- bool is_repl_breakpoint = false ;
910
934
ThreadSP curr_thread;
911
935
StopInfoSP curr_thread_stop_info_sp;
912
936
// Lock the thread list so it doesn't change on us, this is the scope for
@@ -1012,38 +1036,8 @@ bool Process::HandleProcessStateChangedEvent(
1012
1036
: AnyDebuggerCausedStop (thread_list);
1013
1037
}
1014
1038
1015
- BreakpointSiteSP bp_site_sp;
1016
- if (repl_is_enabled && check_for_repl_breakpoint) {
1017
- // Make sure this isn't the internal "REPL" breakpoint
1018
- if (curr_thread) {
1019
- StopInfoSP stop_info_sp = curr_thread->GetStopInfo ();
1020
- if (stop_info_sp) {
1021
- bp_site_sp = process_sp->GetBreakpointSiteList ().FindByID (
1022
- stop_info_sp->GetValue ());
1023
- if (bp_site_sp) {
1024
- is_repl_breakpoint =
1025
- BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
1026
- }
1027
- }
1028
-
1029
- // Only check the breakpoint site for the current PC if the stop
1030
- // reason didn't have
1031
- // a valid breakpoint site
1032
- if (!bp_site_sp) {
1033
- // We might have stopped with a eStopReasonPlanComplete, see the PC
1034
- // is at
1035
-
1036
- lldb::StackFrameSP frame_sp = curr_thread->GetStackFrameAtIndex (0 );
1037
- if (frame_sp) {
1038
- bp_site_sp = process_sp->GetBreakpointSiteList ().FindByAddress (
1039
- frame_sp->GetStackID ().GetPC ());
1040
- if (bp_site_sp)
1041
- is_repl_breakpoint =
1042
- BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
1043
- }
1044
- }
1045
- }
1046
- }
1039
+ bool is_repl_breakpoint = repl_is_enabled && check_for_repl_breakpoint &&
1040
+ IsREPLBreakpoint (curr_thread.get ());
1047
1041
1048
1042
// Drop the ThreadList mutex by here, since GetThreadStatus below might
1049
1043
// have to run code, e.g. for Data formatters, and if we hold the
0 commit comments