blob: 7ba68ee84981bd824f1dfdaba9725a2ed38a5080 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- ThreadPlanStepRange.cpp ---------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Eugene Zelenkoe65b2cf2015-12-15 01:33:19 +000010#include "lldb/Target/ThreadPlanStepRange.h"
Jim Ingham0c61dee2013-03-13 01:56:41 +000011#include "lldb/Breakpoint/BreakpointLocation.h"
12#include "lldb/Breakpoint/BreakpointSite.h"
Jim Ingham564d8bc22012-03-09 04:10:47 +000013#include "lldb/Core/Disassembler.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000014#include "lldb/Symbol/Function.h"
15#include "lldb/Symbol/Symbol.h"
Jim Ingham564d8bc22012-03-09 04:10:47 +000016#include "lldb/Target/ExecutionContext.h"
Greg Claytonf4b47e12010-08-04 01:40:35 +000017#include "lldb/Target/Process.h"
18#include "lldb/Target/RegisterContext.h"
19#include "lldb/Target/StopInfo.h"
Jim Ingham564d8bc22012-03-09 04:10:47 +000020#include "lldb/Target/Target.h"
Greg Claytonf4b47e12010-08-04 01:40:35 +000021#include "lldb/Target/Thread.h"
Jim Ingham564d8bc22012-03-09 04:10:47 +000022#include "lldb/Target/ThreadPlanRunToAddress.h"
Zachary Turner6f9e6902017-03-03 20:56:28 +000023#include "lldb/Utility/Log.h"
Zachary Turnerbf9a7732017-02-02 21:39:50 +000024#include "lldb/Utility/Stream.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000025
26using namespace lldb;
27using namespace lldb_private;
28
Chris Lattner30fdc8d2010-06-08 16:52:24 +000029//----------------------------------------------------------------------
Adrian Prantl05097242018-04-30 16:49:04 +000030// ThreadPlanStepRange: Step through a stack range, either stepping over or
31// into based on the value of \a type.
Chris Lattner30fdc8d2010-06-08 16:52:24 +000032//----------------------------------------------------------------------
33
Kate Stoneb9c1b512016-09-06 20:57:50 +000034ThreadPlanStepRange::ThreadPlanStepRange(ThreadPlanKind kind, const char *name,
35 Thread &thread,
36 const AddressRange &range,
37 const SymbolContext &addr_context,
38 lldb::RunMode stop_others,
39 bool given_ranges_only)
40 : ThreadPlan(kind, name, thread, eVoteNoOpinion, eVoteNoOpinion),
41 m_addr_context(addr_context), m_address_ranges(),
42 m_stop_others(stop_others), m_stack_id(), m_parent_stack_id(),
43 m_no_more_plans(false), m_first_run_event(true), m_use_fast_step(false),
44 m_given_ranges_only(given_ranges_only) {
45 m_use_fast_step = GetTarget().GetUseFastStepping();
46 AddRange(range);
47 m_stack_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
48 StackFrameSP parent_stack = m_thread.GetStackFrameAtIndex(1);
49 if (parent_stack)
50 m_parent_stack_id = parent_stack->GetStackID();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000051}
52
Kate Stoneb9c1b512016-09-06 20:57:50 +000053ThreadPlanStepRange::~ThreadPlanStepRange() { ClearNextBranchBreakpoint(); }
54
55void ThreadPlanStepRange::DidPush() {
56 // See if we can find a "next range" breakpoint:
57 SetNextBranchBreakpoint();
Jim Ingham564d8bc22012-03-09 04:10:47 +000058}
59
Jonas Devliegheree103ae92018-11-15 01:18:15 +000060bool ThreadPlanStepRange::ValidatePlan(Stream *error) {
61 if (m_could_not_resolve_hw_bp) {
62 if (error)
63 error->PutCString(
64 "Could not create hardware breakpoint for thread plan.");
65 return false;
66 }
67 return true;
68}
Kate Stoneb9c1b512016-09-06 20:57:50 +000069
70Vote ThreadPlanStepRange::ShouldReportStop(Event *event_ptr) {
71 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
72
73 const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
74 if (log)
75 log->Printf("ThreadPlanStepRange::ShouldReportStop() returning vote %i\n",
76 vote);
77 return vote;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000078}
79
Kate Stoneb9c1b512016-09-06 20:57:50 +000080void ThreadPlanStepRange::AddRange(const AddressRange &new_range) {
Adrian Prantl05097242018-04-30 16:49:04 +000081 // For now I'm just adding the ranges. At some point we may want to condense
82 // the ranges if they overlap, though I don't think it is likely to be very
83 // important.
Kate Stoneb9c1b512016-09-06 20:57:50 +000084 m_address_ranges.push_back(new_range);
85
86 // Fill the slot for this address range with an empty DisassemblerSP in the
Adrian Prantl05097242018-04-30 16:49:04 +000087 // instruction ranges. I want the indices to match, but I don't want to do
88 // the work to disassemble this range if I don't step into it.
Kate Stoneb9c1b512016-09-06 20:57:50 +000089 m_instruction_ranges.push_back(DisassemblerSP());
Chris Lattner30fdc8d2010-06-08 16:52:24 +000090}
91
Kate Stoneb9c1b512016-09-06 20:57:50 +000092void ThreadPlanStepRange::DumpRanges(Stream *s) {
93 size_t num_ranges = m_address_ranges.size();
94 if (num_ranges == 1) {
95 m_address_ranges[0].Dump(s, m_thread.CalculateTarget().get(),
96 Address::DumpStyleLoadAddress);
97 } else {
98 for (size_t i = 0; i < num_ranges; i++) {
99 s->Printf(" %" PRIu64 ": ", uint64_t(i));
100 m_address_ranges[i].Dump(s, m_thread.CalculateTarget().get(),
101 Address::DumpStyleLoadAddress);
Jim Inghamc4c9fed2011-10-15 00:24:48 +0000102 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000103 }
104}
105
106bool ThreadPlanStepRange::InRange() {
107 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
108 bool ret_value = false;
109
110 lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC();
111
112 size_t num_ranges = m_address_ranges.size();
113 for (size_t i = 0; i < num_ranges; i++) {
114 ret_value = m_address_ranges[i].ContainsLoadAddress(
115 pc_load_addr, m_thread.CalculateTarget().get());
116 if (ret_value)
117 break;
118 }
119
120 if (!ret_value && !m_given_ranges_only) {
121 // See if we've just stepped to another part of the same line number...
122 StackFrame *frame = m_thread.GetStackFrameAtIndex(0).get();
123
124 SymbolContext new_context(
125 frame->GetSymbolContext(eSymbolContextEverything));
126 if (m_addr_context.line_entry.IsValid() &&
127 new_context.line_entry.IsValid()) {
128 if (m_addr_context.line_entry.original_file ==
129 new_context.line_entry.original_file) {
130 if (m_addr_context.line_entry.line == new_context.line_entry.line) {
131 m_addr_context = new_context;
132 AddRange(
133 m_addr_context.line_entry.GetSameLineContiguousAddressRange());
134 ret_value = true;
135 if (log) {
136 StreamString s;
137 m_addr_context.line_entry.Dump(&s, m_thread.CalculateTarget().get(),
138 true, Address::DumpStyleLoadAddress,
139 Address::DumpStyleLoadAddress, true);
140
141 log->Printf(
142 "Step range plan stepped to another range of same line: %s",
143 s.GetData());
144 }
145 } else if (new_context.line_entry.line == 0) {
146 new_context.line_entry.line = m_addr_context.line_entry.line;
147 m_addr_context = new_context;
148 AddRange(
149 m_addr_context.line_entry.GetSameLineContiguousAddressRange());
150 ret_value = true;
151 if (log) {
152 StreamString s;
153 m_addr_context.line_entry.Dump(&s, m_thread.CalculateTarget().get(),
154 true, Address::DumpStyleLoadAddress,
155 Address::DumpStyleLoadAddress, true);
156
157 log->Printf("Step range plan stepped to a range at linenumber 0 "
158 "stepping through that range: %s",
159 s.GetData());
160 }
161 } else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress(
162 m_thread.CalculateTarget().get()) != pc_load_addr) {
163 // Another thing that sometimes happens here is that we step out of
Adrian Prantl05097242018-04-30 16:49:04 +0000164 // one line into the MIDDLE of another line. So far I mostly see
165 // this due to bugs in the debug information. But we probably don't
166 // want to be in the middle of a line range, so in that case reset
167 // the stepping range to the line we've stepped into the middle of
168 // and continue.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000169 m_addr_context = new_context;
170 m_address_ranges.clear();
171 AddRange(m_addr_context.line_entry.range);
172 ret_value = true;
173 if (log) {
174 StreamString s;
175 m_addr_context.line_entry.Dump(&s, m_thread.CalculateTarget().get(),
176 true, Address::DumpStyleLoadAddress,
177 Address::DumpStyleLoadAddress, true);
178
179 log->Printf("Step range plan stepped to the middle of new "
180 "line(%d): %s, continuing to clear this line.",
181 new_context.line_entry.line, s.GetData());
182 }
Jim Inghamc4c9fed2011-10-15 00:24:48 +0000183 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000184 }
Jim Inghamc4c9fed2011-10-15 00:24:48 +0000185 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000186 }
187
188 if (!ret_value && log)
189 log->Printf("Step range plan out of range to 0x%" PRIx64, pc_load_addr);
190
191 return ret_value;
Jim Inghamc4c9fed2011-10-15 00:24:48 +0000192}
193
Kate Stoneb9c1b512016-09-06 20:57:50 +0000194bool ThreadPlanStepRange::InSymbol() {
195 lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
196 if (m_addr_context.function != nullptr) {
197 return m_addr_context.function->GetAddressRange().ContainsLoadAddress(
198 cur_pc, m_thread.CalculateTarget().get());
199 } else if (m_addr_context.symbol && m_addr_context.symbol->ValueIsAddress()) {
200 AddressRange range(m_addr_context.symbol->GetAddressRef(),
201 m_addr_context.symbol->GetByteSize());
202 return range.ContainsLoadAddress(cur_pc, m_thread.CalculateTarget().get());
203 }
204 return false;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000205}
206
Kate Stoneb9c1b512016-09-06 20:57:50 +0000207// FIXME: This should also handle inlining if we aren't going to do inlining in
208// the
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000209// main stack.
210//
211// Ideally we should remember the whole stack frame list, and then compare that
212// to the current list.
213
Kate Stoneb9c1b512016-09-06 20:57:50 +0000214lldb::FrameComparison ThreadPlanStepRange::CompareCurrentFrameToStartFrame() {
215 FrameComparison frame_order;
216
217 StackID cur_frame_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
218
219 if (cur_frame_id == m_stack_id) {
220 frame_order = eFrameCompareEqual;
221 } else if (cur_frame_id < m_stack_id) {
222 frame_order = eFrameCompareYounger;
223 } else {
224 StackFrameSP cur_parent_frame = m_thread.GetStackFrameAtIndex(1);
225 StackID cur_parent_id;
226 if (cur_parent_frame)
227 cur_parent_id = cur_parent_frame->GetStackID();
228 if (m_parent_stack_id.IsValid() && cur_parent_id.IsValid() &&
229 m_parent_stack_id == cur_parent_id)
230 frame_order = eFrameCompareSameParent;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000231 else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000232 frame_order = eFrameCompareOlder;
233 }
234 return frame_order;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000235}
236
Kate Stoneb9c1b512016-09-06 20:57:50 +0000237bool ThreadPlanStepRange::StopOthers() {
238 return (m_stop_others == lldb::eOnlyThisThread ||
239 m_stop_others == lldb::eOnlyDuringStepping);
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000240}
241
Kate Stoneb9c1b512016-09-06 20:57:50 +0000242InstructionList *ThreadPlanStepRange::GetInstructionsForAddress(
243 lldb::addr_t addr, size_t &range_index, size_t &insn_offset) {
244 size_t num_ranges = m_address_ranges.size();
245 for (size_t i = 0; i < num_ranges; i++) {
246 if (m_address_ranges[i].ContainsLoadAddress(addr, &GetTarget())) {
247 // Some joker added a zero size range to the stepping range...
248 if (m_address_ranges[i].GetByteSize() == 0)
249 return nullptr;
Jim Ingham564d8bc22012-03-09 04:10:47 +0000250
Kate Stoneb9c1b512016-09-06 20:57:50 +0000251 if (!m_instruction_ranges[i]) {
252 // Disassemble the address range given:
253 ExecutionContext exe_ctx(m_thread.GetProcess());
254 const char *plugin_name = nullptr;
255 const char *flavor = nullptr;
256 const bool prefer_file_cache = true;
257 m_instruction_ranges[i] = Disassembler::DisassembleRange(
258 GetTarget().GetArchitecture(), plugin_name, flavor, exe_ctx,
259 m_address_ranges[i], prefer_file_cache);
260 }
261 if (!m_instruction_ranges[i])
262 return nullptr;
263 else {
264 // Find where we are in the instruction list as well. If we aren't at
Adrian Prantl05097242018-04-30 16:49:04 +0000265 // an instruction, return nullptr. In this case, we're probably lost,
266 // and shouldn't try to do anything fancy.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000267
268 insn_offset =
269 m_instruction_ranges[i]
270 ->GetInstructionList()
271 .GetIndexOfInstructionAtLoadAddress(addr, GetTarget());
272 if (insn_offset == UINT32_MAX)
273 return nullptr;
274 else {
275 range_index = i;
276 return &m_instruction_ranges[i]->GetInstructionList();
Jim Ingham564d8bc22012-03-09 04:10:47 +0000277 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000278 }
Jim Ingham564d8bc22012-03-09 04:10:47 +0000279 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000280 }
281 return nullptr;
Jim Ingham564d8bc22012-03-09 04:10:47 +0000282}
283
Kate Stoneb9c1b512016-09-06 20:57:50 +0000284void ThreadPlanStepRange::ClearNextBranchBreakpoint() {
285 if (m_next_branch_bp_sp) {
286 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
287 if (log)
288 log->Printf("Removing next branch breakpoint: %d.",
289 m_next_branch_bp_sp->GetID());
290 GetTarget().RemoveBreakpointByID(m_next_branch_bp_sp->GetID());
291 m_next_branch_bp_sp.reset();
Jonas Devliegheree103ae92018-11-15 01:18:15 +0000292 m_could_not_resolve_hw_bp = false;
Kate Stoneb9c1b512016-09-06 20:57:50 +0000293 }
Jim Ingham564d8bc22012-03-09 04:10:47 +0000294}
295
Kate Stoneb9c1b512016-09-06 20:57:50 +0000296bool ThreadPlanStepRange::SetNextBranchBreakpoint() {
297 if (m_next_branch_bp_sp)
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000298 return true;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000299
Kate Stoneb9c1b512016-09-06 20:57:50 +0000300 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
301 // Stepping through ranges using breakpoints doesn't work yet, but with this
Adrian Prantl05097242018-04-30 16:49:04 +0000302 // off we fall back to instruction single stepping.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000303 if (!m_use_fast_step)
Jim Ingham64e7ead2012-05-03 21:19:36 +0000304 return false;
Kate Stoneb9c1b512016-09-06 20:57:50 +0000305
306 lldb::addr_t cur_addr = GetThread().GetRegisterContext()->GetPC();
307 // Find the current address in our address ranges, and fetch the disassembly
308 // if we haven't already:
309 size_t pc_index;
310 size_t range_index;
311 InstructionList *instructions =
312 GetInstructionsForAddress(cur_addr, range_index, pc_index);
313 if (instructions == nullptr)
314 return false;
315 else {
316 Target &target = GetThread().GetProcess()->GetTarget();
317 uint32_t branch_index;
318 branch_index =
319 instructions->GetIndexOfNextBranchInstruction(pc_index, target);
320
321 Address run_to_address;
322
323 // If we didn't find a branch, run to the end of the range.
324 if (branch_index == UINT32_MAX) {
325 uint32_t last_index = instructions->GetSize() - 1;
326 if (last_index - pc_index > 1) {
327 InstructionSP last_inst =
328 instructions->GetInstructionAtIndex(last_index);
329 size_t last_inst_size = last_inst->GetOpcode().GetByteSize();
330 run_to_address = last_inst->GetAddress();
331 run_to_address.Slide(last_inst_size);
332 }
333 } else if (branch_index - pc_index > 1) {
334 run_to_address =
335 instructions->GetInstructionAtIndex(branch_index)->GetAddress();
336 }
337
338 if (run_to_address.IsValid()) {
339 const bool is_internal = true;
340 m_next_branch_bp_sp =
341 GetTarget().CreateBreakpoint(run_to_address, is_internal, false);
342 if (m_next_branch_bp_sp) {
Jonas Devliegheree103ae92018-11-15 01:18:15 +0000343
344 if (m_next_branch_bp_sp->IsHardware() &&
345 !m_next_branch_bp_sp->HasResolvedLocations())
346 m_could_not_resolve_hw_bp = true;
347
Kate Stoneb9c1b512016-09-06 20:57:50 +0000348 if (log) {
349 lldb::break_id_t bp_site_id = LLDB_INVALID_BREAK_ID;
350 BreakpointLocationSP bp_loc =
351 m_next_branch_bp_sp->GetLocationAtIndex(0);
352 if (bp_loc) {
353 BreakpointSiteSP bp_site = bp_loc->GetBreakpointSite();
354 if (bp_site) {
355 bp_site_id = bp_site->GetID();
356 }
357 }
358 log->Printf("ThreadPlanStepRange::SetNextBranchBreakpoint - Setting "
359 "breakpoint %d (site %d) to run to address 0x%" PRIx64,
360 m_next_branch_bp_sp->GetID(), bp_site_id,
361 run_to_address.GetLoadAddress(
362 &m_thread.GetProcess()->GetTarget()));
363 }
Jonas Devliegheree103ae92018-11-15 01:18:15 +0000364
Kate Stoneb9c1b512016-09-06 20:57:50 +0000365 m_next_branch_bp_sp->SetThreadID(m_thread.GetID());
366 m_next_branch_bp_sp->SetBreakpointKind("next-branch-location");
Jonas Devliegheree103ae92018-11-15 01:18:15 +0000367
Kate Stoneb9c1b512016-09-06 20:57:50 +0000368 return true;
369 } else
370 return false;
371 }
372 }
373 return false;
374}
375
376bool ThreadPlanStepRange::NextRangeBreakpointExplainsStop(
377 lldb::StopInfoSP stop_info_sp) {
378 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
379 if (!m_next_branch_bp_sp)
380 return false;
381
382 break_id_t bp_site_id = stop_info_sp->GetValue();
383 BreakpointSiteSP bp_site_sp =
384 m_thread.GetProcess()->GetBreakpointSiteList().FindByID(bp_site_id);
385 if (!bp_site_sp)
386 return false;
387 else if (!bp_site_sp->IsBreakpointAtThisSite(m_next_branch_bp_sp->GetID()))
388 return false;
389 else {
390 // If we've hit the next branch breakpoint, then clear it.
391 size_t num_owners = bp_site_sp->GetNumberOfOwners();
392 bool explains_stop = true;
393 // If all the owners are internal, then we are probably just stepping over
Adrian Prantl05097242018-04-30 16:49:04 +0000394 // this range from multiple threads, or multiple frames, so we want to
395 // continue. If one is not internal, then we should not explain the stop,
Kate Stoneb9c1b512016-09-06 20:57:50 +0000396 // and let the user breakpoint handle the stop.
397 for (size_t i = 0; i < num_owners; i++) {
398 if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal()) {
399 explains_stop = false;
400 break;
401 }
402 }
403 if (log)
404 log->Printf("ThreadPlanStepRange::NextRangeBreakpointExplainsStop - Hit "
405 "next range breakpoint which has %" PRIu64
406 " owners - explains stop: %u.",
407 (uint64_t)num_owners, explains_stop);
408 ClearNextBranchBreakpoint();
409 return explains_stop;
410 }
411}
412
413bool ThreadPlanStepRange::WillStop() { return true; }
414
415StateType ThreadPlanStepRange::GetPlanRunState() {
416 if (m_next_branch_bp_sp)
417 return eStateRunning;
418 else
419 return eStateStepping;
420}
421
422bool ThreadPlanStepRange::MischiefManaged() {
423 // If we have pushed some plans between ShouldStop & MischiefManaged, then
424 // we're not done...
425 // I do this check first because we might have stepped somewhere that will
426 // fool InRange into
427 // thinking it needs to step past the end of that line. This happens, for
Adrian Prantl05097242018-04-30 16:49:04 +0000428 // instance, when stepping over inlined code that is in the middle of the
429 // current line.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000430
431 if (!m_no_more_plans)
432 return false;
433
434 bool done = true;
435 if (!IsPlanComplete()) {
436 if (InRange()) {
437 done = false;
438 } else {
439 FrameComparison frame_order = CompareCurrentFrameToStartFrame();
440 done = (frame_order != eFrameCompareOlder) ? m_no_more_plans : true;
441 }
442 }
443
444 if (done) {
445 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
446 if (log)
447 log->Printf("Completed step through range plan.");
448 ClearNextBranchBreakpoint();
449 ThreadPlan::MischiefManaged();
450 return true;
451 } else {
452 return false;
453 }
454}
455
456bool ThreadPlanStepRange::IsPlanStale() {
457 Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
458 FrameComparison frame_order = CompareCurrentFrameToStartFrame();
459
460 if (frame_order == eFrameCompareOlder) {
461 if (log) {
462 log->Printf("ThreadPlanStepRange::IsPlanStale returning true, we've "
463 "stepped out.");
464 }
465 return true;
466 } else if (frame_order == eFrameCompareEqual && InSymbol()) {
Adrian Prantl05097242018-04-30 16:49:04 +0000467 // If we are not in a place we should step through, we've gotten stale. One
468 // tricky bit here is that some stubs don't push a frame, so we should.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000469 // check that we are in the same symbol.
470 if (!InRange()) {
Boris Ulasevich86aaa8a2017-02-15 11:42:47 +0000471 // Set plan Complete when we reach next instruction just after the range
472 lldb::addr_t addr = m_thread.GetRegisterContext()->GetPC() - 1;
473 size_t num_ranges = m_address_ranges.size();
474 for (size_t i = 0; i < num_ranges; i++) {
475 bool in_range = m_address_ranges[i].ContainsLoadAddress(
476 addr, m_thread.CalculateTarget().get());
477 if (in_range) {
478 SetPlanComplete();
479 }
480 }
Kate Stoneb9c1b512016-09-06 20:57:50 +0000481 return true;
482 }
483 }
484 return false;
Jim Ingham64e7ead2012-05-03 21:19:36 +0000485}