@@ -799,6 +799,31 @@ static bool AnyDebuggerCausedStop(ThreadList &thread_list) {
799
799
return false ;
800
800
}
801
801
802
+ // / Returns true if curr_thread is not null and it is stopped at a REPL
803
+ // / breakpoint.
804
+ static bool IsREPLBreakpoint (Thread *curr_thread) {
805
+ if (!curr_thread)
806
+ return false ;
807
+
808
+ Process &process = *curr_thread->GetProcess ();
809
+
810
+ if (StopInfoSP stop_info_sp = curr_thread->GetStopInfo ())
811
+ if (BreakpointSiteSP bp_site_sp =
812
+ process.GetBreakpointSiteList ().FindByID (stop_info_sp->GetValue ()))
813
+ return BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
814
+
815
+ // Only check the breakpoint site for the current PC if the stop reason didn't
816
+ // have a valid breakpoint site.
817
+ if (StackFrameSP frame_sp = curr_thread->GetStackFrameAtIndex (0 )) {
818
+ if (BreakpointSiteSP bp_site_sp =
819
+ process.GetBreakpointSiteList ().FindByAddress (
820
+ frame_sp->GetStackID ().GetPC ()))
821
+ return BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
822
+ }
823
+
824
+ return false ;
825
+ }
826
+
802
827
bool Process::HandleProcessStateChangedEvent (
803
828
const EventSP &event_sp, Stream *stream,
804
829
SelectMostRelevant select_most_relevant,
@@ -885,7 +910,6 @@ bool Process::HandleProcessStateChangedEvent(
885
910
}
886
911
} else {
887
912
bool check_for_repl_breakpoint = false ;
888
- bool is_repl_breakpoint = false ;
889
913
ThreadSP curr_thread;
890
914
StopInfoSP curr_thread_stop_info_sp;
891
915
// Lock the thread list so it doesn't change on us, this is the scope for
@@ -993,38 +1017,8 @@ bool Process::HandleProcessStateChangedEvent(
993
1017
: AnyDebuggerCausedStop (thread_list);
994
1018
}
995
1019
996
- BreakpointSiteSP bp_site_sp;
997
- if (repl_is_enabled && check_for_repl_breakpoint) {
998
- // Make sure this isn't the internal "REPL" breakpoint
999
- if (curr_thread) {
1000
- StopInfoSP stop_info_sp = curr_thread->GetStopInfo ();
1001
- if (stop_info_sp) {
1002
- bp_site_sp = process_sp->GetBreakpointSiteList ().FindByID (
1003
- stop_info_sp->GetValue ());
1004
- if (bp_site_sp) {
1005
- is_repl_breakpoint =
1006
- BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
1007
- }
1008
- }
1009
-
1010
- // Only check the breakpoint site for the current PC if the stop
1011
- // reason didn't have
1012
- // a valid breakpoint site
1013
- if (!bp_site_sp) {
1014
- // We might have stopped with a eStopReasonPlanComplete, see the PC
1015
- // is at
1016
-
1017
- lldb::StackFrameSP frame_sp = curr_thread->GetStackFrameAtIndex (0 );
1018
- if (frame_sp) {
1019
- bp_site_sp = process_sp->GetBreakpointSiteList ().FindByAddress (
1020
- frame_sp->GetStackID ().GetPC ());
1021
- if (bp_site_sp)
1022
- is_repl_breakpoint =
1023
- BreakpointSiteMatchesREPLBreakpoint (bp_site_sp);
1024
- }
1025
- }
1026
- }
1027
- }
1020
+ bool is_repl_breakpoint = repl_is_enabled && check_for_repl_breakpoint &&
1021
+ IsREPLBreakpoint (curr_thread.get ());
1028
1022
1029
1023
// Drop the ThreadList mutex by here, since GetThreadStatus below might
1030
1024
// have to run code, e.g. for Data formatters, and if we hold the
0 commit comments