annotate lldb/source/Target/ThreadPlanStepUntil.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents c4bab56944e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===-- ThreadPlanStepUntil.cpp -------------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #include "lldb/Target/ThreadPlanStepUntil.h"
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 #include "lldb/Breakpoint/Breakpoint.h"
anatofuz
parents:
diff changeset
12 #include "lldb/Symbol/SymbolContextScope.h"
anatofuz
parents:
diff changeset
13 #include "lldb/Target/Process.h"
anatofuz
parents:
diff changeset
14 #include "lldb/Target/RegisterContext.h"
anatofuz
parents:
diff changeset
15 #include "lldb/Target/StopInfo.h"
anatofuz
parents:
diff changeset
16 #include "lldb/Target/Target.h"
236
c4bab56944e8 LLVM 16
kono
parents: 173
diff changeset
17 #include "lldb/Utility/LLDBLog.h"
150
anatofuz
parents:
diff changeset
18 #include "lldb/Utility/Log.h"
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 using namespace lldb;
anatofuz
parents:
diff changeset
21 using namespace lldb_private;
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 // ThreadPlanStepUntil: Run until we reach a given line number or step out of
anatofuz
parents:
diff changeset
24 // the current frame
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 ThreadPlanStepUntil::ThreadPlanStepUntil(Thread &thread,
anatofuz
parents:
diff changeset
27 lldb::addr_t *address_list,
anatofuz
parents:
diff changeset
28 size_t num_addresses, bool stop_others,
anatofuz
parents:
diff changeset
29 uint32_t frame_idx)
anatofuz
parents:
diff changeset
30 : ThreadPlan(ThreadPlan::eKindStepUntil, "Step until", thread,
anatofuz
parents:
diff changeset
31 eVoteNoOpinion, eVoteNoOpinion),
anatofuz
parents:
diff changeset
32 m_step_from_insn(LLDB_INVALID_ADDRESS),
anatofuz
parents:
diff changeset
33 m_return_bp_id(LLDB_INVALID_BREAK_ID),
anatofuz
parents:
diff changeset
34 m_return_addr(LLDB_INVALID_ADDRESS), m_stepped_out(false),
anatofuz
parents:
diff changeset
35 m_should_stop(false), m_ran_analyze(false), m_explains_stop(false),
anatofuz
parents:
diff changeset
36 m_until_points(), m_stop_others(stop_others) {
anatofuz
parents:
diff changeset
37 // Stash away our "until" addresses:
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
38 TargetSP target_sp(thread.CalculateTarget());
150
anatofuz
parents:
diff changeset
39
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
40 StackFrameSP frame_sp(thread.GetStackFrameAtIndex(frame_idx));
150
anatofuz
parents:
diff changeset
41 if (frame_sp) {
anatofuz
parents:
diff changeset
42 m_step_from_insn = frame_sp->GetStackID().GetPC();
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 // Find the return address and set a breakpoint there:
anatofuz
parents:
diff changeset
45 // FIXME - can we do this more securely if we know first_insn?
anatofuz
parents:
diff changeset
46
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
47 StackFrameSP return_frame_sp(thread.GetStackFrameAtIndex(frame_idx + 1));
150
anatofuz
parents:
diff changeset
48 if (return_frame_sp) {
anatofuz
parents:
diff changeset
49 // TODO: add inline functionality
anatofuz
parents:
diff changeset
50 m_return_addr = return_frame_sp->GetStackID().GetPC();
anatofuz
parents:
diff changeset
51 Breakpoint *return_bp =
anatofuz
parents:
diff changeset
52 target_sp->CreateBreakpoint(m_return_addr, true, false).get();
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 if (return_bp != nullptr) {
anatofuz
parents:
diff changeset
55 if (return_bp->IsHardware() && !return_bp->HasResolvedLocations())
anatofuz
parents:
diff changeset
56 m_could_not_resolve_hw_bp = true;
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
57 return_bp->SetThreadID(m_tid);
150
anatofuz
parents:
diff changeset
58 m_return_bp_id = return_bp->GetID();
anatofuz
parents:
diff changeset
59 return_bp->SetBreakpointKind("until-return-backstop");
anatofuz
parents:
diff changeset
60 }
anatofuz
parents:
diff changeset
61 }
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 m_stack_id = frame_sp->GetStackID();
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 // Now set breakpoints on all our return addresses:
anatofuz
parents:
diff changeset
66 for (size_t i = 0; i < num_addresses; i++) {
anatofuz
parents:
diff changeset
67 Breakpoint *until_bp =
anatofuz
parents:
diff changeset
68 target_sp->CreateBreakpoint(address_list[i], true, false).get();
anatofuz
parents:
diff changeset
69 if (until_bp != nullptr) {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
70 until_bp->SetThreadID(m_tid);
150
anatofuz
parents:
diff changeset
71 m_until_points[address_list[i]] = until_bp->GetID();
anatofuz
parents:
diff changeset
72 until_bp->SetBreakpointKind("until-target");
anatofuz
parents:
diff changeset
73 } else {
anatofuz
parents:
diff changeset
74 m_until_points[address_list[i]] = LLDB_INVALID_BREAK_ID;
anatofuz
parents:
diff changeset
75 }
anatofuz
parents:
diff changeset
76 }
anatofuz
parents:
diff changeset
77 }
anatofuz
parents:
diff changeset
78 }
anatofuz
parents:
diff changeset
79
anatofuz
parents:
diff changeset
80 ThreadPlanStepUntil::~ThreadPlanStepUntil() { Clear(); }
anatofuz
parents:
diff changeset
81
anatofuz
parents:
diff changeset
82 void ThreadPlanStepUntil::Clear() {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
83 Target &target = GetTarget();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
84 if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
85 target.RemoveBreakpointByID(m_return_bp_id);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
86 m_return_bp_id = LLDB_INVALID_BREAK_ID;
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
87 }
150
anatofuz
parents:
diff changeset
88
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
89 until_collection::iterator pos, end = m_until_points.end();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
90 for (pos = m_until_points.begin(); pos != end; pos++) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
91 target.RemoveBreakpointByID((*pos).second);
150
anatofuz
parents:
diff changeset
92 }
anatofuz
parents:
diff changeset
93 m_until_points.clear();
anatofuz
parents:
diff changeset
94 m_could_not_resolve_hw_bp = false;
anatofuz
parents:
diff changeset
95 }
anatofuz
parents:
diff changeset
96
anatofuz
parents:
diff changeset
97 void ThreadPlanStepUntil::GetDescription(Stream *s,
anatofuz
parents:
diff changeset
98 lldb::DescriptionLevel level) {
anatofuz
parents:
diff changeset
99 if (level == lldb::eDescriptionLevelBrief) {
anatofuz
parents:
diff changeset
100 s->Printf("step until");
anatofuz
parents:
diff changeset
101 if (m_stepped_out)
anatofuz
parents:
diff changeset
102 s->Printf(" - stepped out");
anatofuz
parents:
diff changeset
103 } else {
anatofuz
parents:
diff changeset
104 if (m_until_points.size() == 1)
anatofuz
parents:
diff changeset
105 s->Printf("Stepping from address 0x%" PRIx64 " until we reach 0x%" PRIx64
anatofuz
parents:
diff changeset
106 " using breakpoint %d",
anatofuz
parents:
diff changeset
107 (uint64_t)m_step_from_insn,
anatofuz
parents:
diff changeset
108 (uint64_t)(*m_until_points.begin()).first,
anatofuz
parents:
diff changeset
109 (*m_until_points.begin()).second);
anatofuz
parents:
diff changeset
110 else {
anatofuz
parents:
diff changeset
111 until_collection::iterator pos, end = m_until_points.end();
anatofuz
parents:
diff changeset
112 s->Printf("Stepping from address 0x%" PRIx64 " until we reach one of:",
anatofuz
parents:
diff changeset
113 (uint64_t)m_step_from_insn);
anatofuz
parents:
diff changeset
114 for (pos = m_until_points.begin(); pos != end; pos++) {
anatofuz
parents:
diff changeset
115 s->Printf("\n\t0x%" PRIx64 " (bp: %d)", (uint64_t)(*pos).first,
anatofuz
parents:
diff changeset
116 (*pos).second);
anatofuz
parents:
diff changeset
117 }
anatofuz
parents:
diff changeset
118 }
anatofuz
parents:
diff changeset
119 s->Printf(" stepped out address is 0x%" PRIx64 ".",
anatofuz
parents:
diff changeset
120 (uint64_t)m_return_addr);
anatofuz
parents:
diff changeset
121 }
anatofuz
parents:
diff changeset
122 }
anatofuz
parents:
diff changeset
123
anatofuz
parents:
diff changeset
124 bool ThreadPlanStepUntil::ValidatePlan(Stream *error) {
anatofuz
parents:
diff changeset
125 if (m_could_not_resolve_hw_bp) {
anatofuz
parents:
diff changeset
126 if (error)
anatofuz
parents:
diff changeset
127 error->PutCString(
anatofuz
parents:
diff changeset
128 "Could not create hardware breakpoint for thread plan.");
anatofuz
parents:
diff changeset
129 return false;
anatofuz
parents:
diff changeset
130 } else if (m_return_bp_id == LLDB_INVALID_BREAK_ID) {
anatofuz
parents:
diff changeset
131 if (error)
anatofuz
parents:
diff changeset
132 error->PutCString("Could not create return breakpoint.");
anatofuz
parents:
diff changeset
133 return false;
anatofuz
parents:
diff changeset
134 } else {
anatofuz
parents:
diff changeset
135 until_collection::iterator pos, end = m_until_points.end();
anatofuz
parents:
diff changeset
136 for (pos = m_until_points.begin(); pos != end; pos++) {
anatofuz
parents:
diff changeset
137 if (!LLDB_BREAK_ID_IS_VALID((*pos).second))
anatofuz
parents:
diff changeset
138 return false;
anatofuz
parents:
diff changeset
139 }
anatofuz
parents:
diff changeset
140 return true;
anatofuz
parents:
diff changeset
141 }
anatofuz
parents:
diff changeset
142 }
anatofuz
parents:
diff changeset
143
anatofuz
parents:
diff changeset
144 void ThreadPlanStepUntil::AnalyzeStop() {
anatofuz
parents:
diff changeset
145 if (m_ran_analyze)
anatofuz
parents:
diff changeset
146 return;
anatofuz
parents:
diff changeset
147
anatofuz
parents:
diff changeset
148 StopInfoSP stop_info_sp = GetPrivateStopInfo();
anatofuz
parents:
diff changeset
149 m_should_stop = true;
anatofuz
parents:
diff changeset
150 m_explains_stop = false;
anatofuz
parents:
diff changeset
151
anatofuz
parents:
diff changeset
152 if (stop_info_sp) {
anatofuz
parents:
diff changeset
153 StopReason reason = stop_info_sp->GetStopReason();
anatofuz
parents:
diff changeset
154
anatofuz
parents:
diff changeset
155 if (reason == eStopReasonBreakpoint) {
anatofuz
parents:
diff changeset
156 // If this is OUR breakpoint, we're fine, otherwise we don't know why
anatofuz
parents:
diff changeset
157 // this happened...
anatofuz
parents:
diff changeset
158 BreakpointSiteSP this_site =
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
159 m_process.GetBreakpointSiteList().FindByID(stop_info_sp->GetValue());
150
anatofuz
parents:
diff changeset
160 if (!this_site) {
anatofuz
parents:
diff changeset
161 m_explains_stop = false;
anatofuz
parents:
diff changeset
162 return;
anatofuz
parents:
diff changeset
163 }
anatofuz
parents:
diff changeset
164
anatofuz
parents:
diff changeset
165 if (this_site->IsBreakpointAtThisSite(m_return_bp_id)) {
anatofuz
parents:
diff changeset
166 // If we are at our "step out" breakpoint, and the stack depth has
anatofuz
parents:
diff changeset
167 // shrunk, then this is indeed our stop. If the stack depth has grown,
anatofuz
parents:
diff changeset
168 // then we've hit our step out breakpoint recursively. If we are the
anatofuz
parents:
diff changeset
169 // only breakpoint at that location, then we do explain the stop, and
anatofuz
parents:
diff changeset
170 // we'll just continue. If there was another breakpoint here, then we
anatofuz
parents:
diff changeset
171 // don't explain the stop, but we won't mark ourselves Completed,
anatofuz
parents:
diff changeset
172 // because maybe that breakpoint will continue, and then we'll finish
anatofuz
parents:
diff changeset
173 // the "until".
anatofuz
parents:
diff changeset
174 bool done;
anatofuz
parents:
diff changeset
175 StackID cur_frame_zero_id;
anatofuz
parents:
diff changeset
176
anatofuz
parents:
diff changeset
177 done = (m_stack_id < cur_frame_zero_id);
anatofuz
parents:
diff changeset
178
anatofuz
parents:
diff changeset
179 if (done) {
anatofuz
parents:
diff changeset
180 m_stepped_out = true;
anatofuz
parents:
diff changeset
181 SetPlanComplete();
anatofuz
parents:
diff changeset
182 } else
anatofuz
parents:
diff changeset
183 m_should_stop = false;
anatofuz
parents:
diff changeset
184
anatofuz
parents:
diff changeset
185 if (this_site->GetNumberOfOwners() == 1)
anatofuz
parents:
diff changeset
186 m_explains_stop = true;
anatofuz
parents:
diff changeset
187 else
anatofuz
parents:
diff changeset
188 m_explains_stop = false;
anatofuz
parents:
diff changeset
189 return;
anatofuz
parents:
diff changeset
190 } else {
anatofuz
parents:
diff changeset
191 // Check if we've hit one of our "until" breakpoints.
anatofuz
parents:
diff changeset
192 until_collection::iterator pos, end = m_until_points.end();
anatofuz
parents:
diff changeset
193 for (pos = m_until_points.begin(); pos != end; pos++) {
anatofuz
parents:
diff changeset
194 if (this_site->IsBreakpointAtThisSite((*pos).second)) {
anatofuz
parents:
diff changeset
195 // If we're at the right stack depth, then we're done.
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
196 Thread &thread = GetThread();
150
anatofuz
parents:
diff changeset
197 bool done;
anatofuz
parents:
diff changeset
198 StackID frame_zero_id =
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
199 thread.GetStackFrameAtIndex(0)->GetStackID();
150
anatofuz
parents:
diff changeset
200
anatofuz
parents:
diff changeset
201 if (frame_zero_id == m_stack_id)
anatofuz
parents:
diff changeset
202 done = true;
anatofuz
parents:
diff changeset
203 else if (frame_zero_id < m_stack_id)
anatofuz
parents:
diff changeset
204 done = false;
anatofuz
parents:
diff changeset
205 else {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
206 StackFrameSP older_frame_sp = thread.GetStackFrameAtIndex(1);
150
anatofuz
parents:
diff changeset
207
anatofuz
parents:
diff changeset
208 // But if we can't even unwind one frame we should just get out
anatofuz
parents:
diff changeset
209 // of here & stop...
anatofuz
parents:
diff changeset
210 if (older_frame_sp) {
anatofuz
parents:
diff changeset
211 const SymbolContext &older_context =
anatofuz
parents:
diff changeset
212 older_frame_sp->GetSymbolContext(eSymbolContextEverything);
anatofuz
parents:
diff changeset
213 SymbolContext stack_context;
anatofuz
parents:
diff changeset
214 m_stack_id.GetSymbolContextScope()->CalculateSymbolContext(
anatofuz
parents:
diff changeset
215 &stack_context);
anatofuz
parents:
diff changeset
216
anatofuz
parents:
diff changeset
217 done = (older_context == stack_context);
anatofuz
parents:
diff changeset
218 } else
anatofuz
parents:
diff changeset
219 done = false;
anatofuz
parents:
diff changeset
220 }
anatofuz
parents:
diff changeset
221
anatofuz
parents:
diff changeset
222 if (done)
anatofuz
parents:
diff changeset
223 SetPlanComplete();
anatofuz
parents:
diff changeset
224 else
anatofuz
parents:
diff changeset
225 m_should_stop = false;
anatofuz
parents:
diff changeset
226
anatofuz
parents:
diff changeset
227 // Otherwise we've hit this breakpoint recursively. If we're the
anatofuz
parents:
diff changeset
228 // only breakpoint here, then we do explain the stop, and we'll
anatofuz
parents:
diff changeset
229 // continue. If not then we should let higher plans handle this
anatofuz
parents:
diff changeset
230 // stop.
anatofuz
parents:
diff changeset
231 if (this_site->GetNumberOfOwners() == 1)
anatofuz
parents:
diff changeset
232 m_explains_stop = true;
anatofuz
parents:
diff changeset
233 else {
anatofuz
parents:
diff changeset
234 m_should_stop = true;
anatofuz
parents:
diff changeset
235 m_explains_stop = false;
anatofuz
parents:
diff changeset
236 }
anatofuz
parents:
diff changeset
237 return;
anatofuz
parents:
diff changeset
238 }
anatofuz
parents:
diff changeset
239 }
anatofuz
parents:
diff changeset
240 }
anatofuz
parents:
diff changeset
241 // If we get here we haven't hit any of our breakpoints, so let the
anatofuz
parents:
diff changeset
242 // higher plans take care of the stop.
anatofuz
parents:
diff changeset
243 m_explains_stop = false;
anatofuz
parents:
diff changeset
244 return;
anatofuz
parents:
diff changeset
245 } else if (IsUsuallyUnexplainedStopReason(reason)) {
anatofuz
parents:
diff changeset
246 m_explains_stop = false;
anatofuz
parents:
diff changeset
247 } else {
anatofuz
parents:
diff changeset
248 m_explains_stop = true;
anatofuz
parents:
diff changeset
249 }
anatofuz
parents:
diff changeset
250 }
anatofuz
parents:
diff changeset
251 }
anatofuz
parents:
diff changeset
252
anatofuz
parents:
diff changeset
253 bool ThreadPlanStepUntil::DoPlanExplainsStop(Event *event_ptr) {
anatofuz
parents:
diff changeset
254 // We don't explain signals or breakpoints (breakpoints that handle stepping
anatofuz
parents:
diff changeset
255 // in or out will be handled by a child plan.
anatofuz
parents:
diff changeset
256 AnalyzeStop();
anatofuz
parents:
diff changeset
257 return m_explains_stop;
anatofuz
parents:
diff changeset
258 }
anatofuz
parents:
diff changeset
259
anatofuz
parents:
diff changeset
260 bool ThreadPlanStepUntil::ShouldStop(Event *event_ptr) {
anatofuz
parents:
diff changeset
261 // If we've told our self in ExplainsStop that we plan to continue, then do
anatofuz
parents:
diff changeset
262 // so here. Otherwise, as long as this thread has stopped for a reason, we
anatofuz
parents:
diff changeset
263 // will stop.
anatofuz
parents:
diff changeset
264
anatofuz
parents:
diff changeset
265 StopInfoSP stop_info_sp = GetPrivateStopInfo();
anatofuz
parents:
diff changeset
266 if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone)
anatofuz
parents:
diff changeset
267 return false;
anatofuz
parents:
diff changeset
268
anatofuz
parents:
diff changeset
269 AnalyzeStop();
anatofuz
parents:
diff changeset
270 return m_should_stop;
anatofuz
parents:
diff changeset
271 }
anatofuz
parents:
diff changeset
272
anatofuz
parents:
diff changeset
273 bool ThreadPlanStepUntil::StopOthers() { return m_stop_others; }
anatofuz
parents:
diff changeset
274
anatofuz
parents:
diff changeset
275 StateType ThreadPlanStepUntil::GetPlanRunState() { return eStateRunning; }
anatofuz
parents:
diff changeset
276
anatofuz
parents:
diff changeset
277 bool ThreadPlanStepUntil::DoWillResume(StateType resume_state,
anatofuz
parents:
diff changeset
278 bool current_plan) {
anatofuz
parents:
diff changeset
279 if (current_plan) {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
280 Target &target = GetTarget();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
281 Breakpoint *return_bp = target.GetBreakpointByID(m_return_bp_id).get();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
282 if (return_bp != nullptr)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
283 return_bp->SetEnabled(true);
150
anatofuz
parents:
diff changeset
284
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
285 until_collection::iterator pos, end = m_until_points.end();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
286 for (pos = m_until_points.begin(); pos != end; pos++) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
287 Breakpoint *until_bp = target.GetBreakpointByID((*pos).second).get();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
288 if (until_bp != nullptr)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
289 until_bp->SetEnabled(true);
150
anatofuz
parents:
diff changeset
290 }
anatofuz
parents:
diff changeset
291 }
anatofuz
parents:
diff changeset
292
anatofuz
parents:
diff changeset
293 m_should_stop = true;
anatofuz
parents:
diff changeset
294 m_ran_analyze = false;
anatofuz
parents:
diff changeset
295 m_explains_stop = false;
anatofuz
parents:
diff changeset
296 return true;
anatofuz
parents:
diff changeset
297 }
anatofuz
parents:
diff changeset
298
anatofuz
parents:
diff changeset
299 bool ThreadPlanStepUntil::WillStop() {
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
300 Target &target = GetTarget();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
301 Breakpoint *return_bp = target.GetBreakpointByID(m_return_bp_id).get();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
302 if (return_bp != nullptr)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
303 return_bp->SetEnabled(false);
150
anatofuz
parents:
diff changeset
304
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
305 until_collection::iterator pos, end = m_until_points.end();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
306 for (pos = m_until_points.begin(); pos != end; pos++) {
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
307 Breakpoint *until_bp = target.GetBreakpointByID((*pos).second).get();
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
308 if (until_bp != nullptr)
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
309 until_bp->SetEnabled(false);
150
anatofuz
parents:
diff changeset
310 }
anatofuz
parents:
diff changeset
311 return true;
anatofuz
parents:
diff changeset
312 }
anatofuz
parents:
diff changeset
313
anatofuz
parents:
diff changeset
314 bool ThreadPlanStepUntil::MischiefManaged() {
anatofuz
parents:
diff changeset
315 // I'm letting "PlanExplainsStop" do all the work, and just reporting that
anatofuz
parents:
diff changeset
316 // here.
anatofuz
parents:
diff changeset
317 bool done = false;
anatofuz
parents:
diff changeset
318 if (IsPlanComplete()) {
236
c4bab56944e8 LLVM 16
kono
parents: 173
diff changeset
319 Log *log = GetLog(LLDBLog::Step);
150
anatofuz
parents:
diff changeset
320 LLDB_LOGF(log, "Completed step until plan.");
anatofuz
parents:
diff changeset
321
anatofuz
parents:
diff changeset
322 Clear();
anatofuz
parents:
diff changeset
323 done = true;
anatofuz
parents:
diff changeset
324 }
anatofuz
parents:
diff changeset
325 if (done)
anatofuz
parents:
diff changeset
326 ThreadPlan::MischiefManaged();
anatofuz
parents:
diff changeset
327
anatofuz
parents:
diff changeset
328 return done;
anatofuz
parents:
diff changeset
329 }