[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 08:23:27 +01:00
|
|
|
//===-- ThreadPlanStepUntil.cpp -------------------------------------------===//
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2015-12-15 01:33:19 +00:00
|
|
|
#include "lldb/Target/ThreadPlanStepUntil.h"
|
2017-04-06 21:28:29 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2017-04-06 21:28:29 +00:00
|
|
|
#include "lldb/Symbol/SymbolContextScope.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2010-08-04 01:40:35 +00:00
|
|
|
#include "lldb/Target/StopInfo.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Target/Target.h"
|
2022-02-03 13:26:10 +01:00
|
|
|
#include "lldb/Utility/LLDBLog.h"
|
2017-03-03 20:56:28 +00:00
|
|
|
#include "lldb/Utility/Log.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
// ThreadPlanStepUntil: Run until we reach a given line number or step out of
|
|
|
|
|
// the current frame
|
|
|
|
|
|
|
|
|
|
ThreadPlanStepUntil::ThreadPlanStepUntil(Thread &thread,
|
|
|
|
|
lldb::addr_t *address_list,
|
|
|
|
|
size_t num_addresses, bool stop_others,
|
2011-01-21 06:11:58 +00:00
|
|
|
uint32_t frame_idx)
|
2010-06-19 04:45:32 +00:00
|
|
|
: ThreadPlan(ThreadPlan::eKindStepUntil, "Step until", thread,
|
|
|
|
|
eVoteNoOpinion, eVoteNoOpinion),
|
2010-06-08 16:52:24 +00:00
|
|
|
m_step_from_insn(LLDB_INVALID_ADDRESS),
|
2012-03-01 00:50:50 +00:00
|
|
|
m_return_bp_id(LLDB_INVALID_BREAK_ID),
|
2010-07-09 20:39:50 +00:00
|
|
|
m_return_addr(LLDB_INVALID_ADDRESS), m_stepped_out(false),
|
2012-03-01 00:50:50 +00:00
|
|
|
m_should_stop(false), m_ran_analyze(false), m_explains_stop(false),
|
2010-06-08 16:52:24 +00:00
|
|
|
m_until_points(), m_stop_others(stop_others) {
|
|
|
|
|
// Stash away our "until" addresses:
|
2020-03-10 14:03:53 -07:00
|
|
|
TargetSP target_sp(thread.CalculateTarget());
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2020-03-10 14:03:53 -07:00
|
|
|
StackFrameSP frame_sp(thread.GetStackFrameAtIndex(frame_idx));
|
2011-01-21 06:11:58 +00:00
|
|
|
if (frame_sp) {
|
|
|
|
|
m_step_from_insn = frame_sp->GetStackID().GetPC();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-01-21 06:11:58 +00:00
|
|
|
// Find the return address and set a breakpoint there:
|
|
|
|
|
// FIXME - can we do this more securely if we know first_insn?
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2020-03-10 14:03:53 -07:00
|
|
|
StackFrameSP return_frame_sp(thread.GetStackFrameAtIndex(frame_idx + 1));
|
2011-01-21 06:11:58 +00:00
|
|
|
if (return_frame_sp) {
|
|
|
|
|
// TODO: add inline functionality
|
|
|
|
|
m_return_addr = return_frame_sp->GetStackID().GetPC();
|
2013-10-11 19:48:25 +00:00
|
|
|
Breakpoint *return_bp =
|
|
|
|
|
target_sp->CreateBreakpoint(m_return_addr, true, false).get();
|
2018-11-15 01:18:15 +00:00
|
|
|
|
2015-12-15 01:33:19 +00:00
|
|
|
if (return_bp != nullptr) {
|
2018-11-15 01:18:15 +00:00
|
|
|
if (return_bp->IsHardware() && !return_bp->HasResolvedLocations())
|
|
|
|
|
m_could_not_resolve_hw_bp = true;
|
2020-03-10 14:03:53 -07:00
|
|
|
return_bp->SetThreadID(m_tid);
|
2011-01-21 06:11:58 +00:00
|
|
|
m_return_bp_id = return_bp->GetID();
|
2013-01-26 02:19:28 +00:00
|
|
|
return_bp->SetBreakpointKind("until-return-backstop");
|
2011-01-21 06:11:58 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
2011-01-21 06:11:58 +00:00
|
|
|
|
2014-08-11 23:57:43 +00:00
|
|
|
m_stack_id = frame_sp->GetStackID();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-01-21 06:11:58 +00:00
|
|
|
// Now set breakpoints on all our return addresses:
|
2013-06-19 19:04:53 +00:00
|
|
|
for (size_t i = 0; i < num_addresses; i++) {
|
2013-10-11 19:48:25 +00:00
|
|
|
Breakpoint *until_bp =
|
|
|
|
|
target_sp->CreateBreakpoint(address_list[i], true, false).get();
|
2015-12-15 01:33:19 +00:00
|
|
|
if (until_bp != nullptr) {
|
2020-03-10 14:03:53 -07:00
|
|
|
until_bp->SetThreadID(m_tid);
|
2011-01-21 06:11:58 +00:00
|
|
|
m_until_points[address_list[i]] = until_bp->GetID();
|
2013-01-26 02:19:28 +00:00
|
|
|
until_bp->SetBreakpointKind("until-target");
|
2011-01-21 06:11:58 +00:00
|
|
|
} else {
|
|
|
|
|
m_until_points[address_list[i]] = LLDB_INVALID_BREAK_ID;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadPlanStepUntil::~ThreadPlanStepUntil() { Clear(); }
|
|
|
|
|
|
|
|
|
|
void ThreadPlanStepUntil::Clear() {
|
2020-03-10 14:03:53 -07:00
|
|
|
Target &target = GetTarget();
|
|
|
|
|
if (m_return_bp_id != LLDB_INVALID_BREAK_ID) {
|
|
|
|
|
target.RemoveBreakpointByID(m_return_bp_id);
|
|
|
|
|
m_return_bp_id = LLDB_INVALID_BREAK_ID;
|
|
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2020-03-10 14:03:53 -07:00
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
|
|
|
|
target.RemoveBreakpointByID((*pos).second);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
m_until_points.clear();
|
2018-11-15 01:18:15 +00:00
|
|
|
m_could_not_resolve_hw_bp = false;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ThreadPlanStepUntil::GetDescription(Stream *s,
|
|
|
|
|
lldb::DescriptionLevel level) {
|
|
|
|
|
if (level == lldb::eDescriptionLevelBrief) {
|
|
|
|
|
s->Printf("step until");
|
|
|
|
|
if (m_stepped_out)
|
|
|
|
|
s->Printf(" - stepped out");
|
|
|
|
|
} else {
|
|
|
|
|
if (m_until_points.size() == 1)
|
2012-11-29 21:49:15 +00:00
|
|
|
s->Printf("Stepping from address 0x%" PRIx64 " until we reach 0x%" PRIx64
|
|
|
|
|
" using breakpoint %d",
|
2010-06-08 16:52:24 +00:00
|
|
|
(uint64_t)m_step_from_insn,
|
|
|
|
|
(uint64_t)(*m_until_points.begin()).first,
|
|
|
|
|
(*m_until_points.begin()).second);
|
|
|
|
|
else {
|
|
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
2012-11-29 21:49:15 +00:00
|
|
|
s->Printf("Stepping from address 0x%" PRIx64 " until we reach one of:",
|
2010-06-08 16:52:24 +00:00
|
|
|
(uint64_t)m_step_from_insn);
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
2012-11-29 21:49:15 +00:00
|
|
|
s->Printf("\n\t0x%" PRIx64 " (bp: %d)", (uint64_t)(*pos).first,
|
|
|
|
|
(*pos).second);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
2012-11-29 21:49:15 +00:00
|
|
|
s->Printf(" stepped out address is 0x%" PRIx64 ".",
|
|
|
|
|
(uint64_t)m_return_addr);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ThreadPlanStepUntil::ValidatePlan(Stream *error) {
|
2018-11-15 01:18:15 +00:00
|
|
|
if (m_could_not_resolve_hw_bp) {
|
|
|
|
|
if (error)
|
|
|
|
|
error->PutCString(
|
|
|
|
|
"Could not create hardware breakpoint for thread plan.");
|
|
|
|
|
return false;
|
|
|
|
|
} else if (m_return_bp_id == LLDB_INVALID_BREAK_ID) {
|
|
|
|
|
if (error)
|
|
|
|
|
error->PutCString("Could not create return breakpoint.");
|
2010-06-08 16:52:24 +00:00
|
|
|
return false;
|
2018-11-15 01:18:15 +00:00
|
|
|
} else {
|
2010-06-08 16:52:24 +00:00
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
|
|
|
|
if (!LLDB_BREAK_ID_IS_VALID((*pos).second))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ThreadPlanStepUntil::AnalyzeStop() {
|
|
|
|
|
if (m_ran_analyze)
|
2016-09-06 20:57:50 +00:00
|
|
|
return;
|
|
|
|
|
|
2013-06-04 01:40:51 +00:00
|
|
|
StopInfoSP stop_info_sp = GetPrivateStopInfo();
|
2010-06-08 16:52:24 +00:00
|
|
|
m_should_stop = true;
|
|
|
|
|
m_explains_stop = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-10-20 00:39:53 +00:00
|
|
|
if (stop_info_sp) {
|
|
|
|
|
StopReason reason = stop_info_sp->GetStopReason();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
if (reason == eStopReasonBreakpoint) {
|
2018-04-30 16:49:04 +00:00
|
|
|
// If this is OUR breakpoint, we're fine, otherwise we don't know why
|
|
|
|
|
// this happened...
|
2015-07-23 19:55:02 +00:00
|
|
|
BreakpointSiteSP this_site =
|
2020-03-10 14:03:53 -07:00
|
|
|
m_process.GetBreakpointSiteList().FindByID(stop_info_sp->GetValue());
|
2015-07-23 19:55:02 +00:00
|
|
|
if (!this_site) {
|
2010-06-08 16:52:24 +00:00
|
|
|
m_explains_stop = false;
|
|
|
|
|
return;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2010-10-20 00:39:53 +00:00
|
|
|
if (this_site->IsBreakpointAtThisSite(m_return_bp_id)) {
|
|
|
|
|
// If we are at our "step out" breakpoint, and the stack depth has
|
2018-04-30 16:49:04 +00:00
|
|
|
// shrunk, then this is indeed our stop. If the stack depth has grown,
|
|
|
|
|
// then we've hit our step out breakpoint recursively. If we are the
|
|
|
|
|
// only breakpoint at that location, then we do explain the stop, and
|
|
|
|
|
// we'll just continue. If there was another breakpoint here, then we
|
|
|
|
|
// don't explain the stop, but we won't mark ourselves Completed,
|
|
|
|
|
// because maybe that breakpoint will continue, and then we'll finish
|
|
|
|
|
// the "until".
|
2015-07-23 19:55:02 +00:00
|
|
|
bool done;
|
|
|
|
|
StackID cur_frame_zero_id;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
done = (m_stack_id < cur_frame_zero_id);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
if (done) {
|
|
|
|
|
m_stepped_out = true;
|
|
|
|
|
SetPlanComplete();
|
2016-09-06 20:57:50 +00:00
|
|
|
} else
|
2015-07-23 19:55:02 +00:00
|
|
|
m_should_stop = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
if (this_site->GetNumberOfOwners() == 1)
|
|
|
|
|
m_explains_stop = true;
|
2016-09-06 20:57:50 +00:00
|
|
|
else
|
2010-06-08 16:52:24 +00:00
|
|
|
m_explains_stop = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
return;
|
|
|
|
|
} else {
|
2015-07-23 19:55:02 +00:00
|
|
|
// Check if we've hit one of our "until" breakpoints.
|
|
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
|
|
|
|
if (this_site->IsBreakpointAtThisSite((*pos).second)) {
|
|
|
|
|
// If we're at the right stack depth, then we're done.
|
2020-03-10 14:03:53 -07:00
|
|
|
Thread &thread = GetThread();
|
2015-07-23 19:55:02 +00:00
|
|
|
bool done;
|
|
|
|
|
StackID frame_zero_id =
|
2020-03-10 14:03:53 -07:00
|
|
|
thread.GetStackFrameAtIndex(0)->GetStackID();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
if (frame_zero_id == m_stack_id)
|
|
|
|
|
done = true;
|
|
|
|
|
else if (frame_zero_id < m_stack_id)
|
|
|
|
|
done = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
else {
|
2020-03-10 14:03:53 -07:00
|
|
|
StackFrameSP older_frame_sp = thread.GetStackFrameAtIndex(1);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// But if we can't even unwind one frame we should just get out
|
|
|
|
|
// of here & stop...
|
2015-07-23 19:55:02 +00:00
|
|
|
if (older_frame_sp) {
|
|
|
|
|
const SymbolContext &older_context =
|
|
|
|
|
older_frame_sp->GetSymbolContext(eSymbolContextEverything);
|
|
|
|
|
SymbolContext stack_context;
|
|
|
|
|
m_stack_id.GetSymbolContextScope()->CalculateSymbolContext(
|
|
|
|
|
&stack_context);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-12-15 01:33:19 +00:00
|
|
|
done = (older_context == stack_context);
|
2016-09-06 20:57:50 +00:00
|
|
|
} else
|
2015-07-23 19:55:02 +00:00
|
|
|
done = false;
|
|
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
if (done)
|
|
|
|
|
SetPlanComplete();
|
|
|
|
|
else
|
|
|
|
|
m_should_stop = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-07-23 19:55:02 +00:00
|
|
|
// Otherwise we've hit this breakpoint recursively. If we're the
|
|
|
|
|
// only breakpoint here, then we do explain the stop, and we'll
|
2018-04-30 16:49:04 +00:00
|
|
|
// continue. If not then we should let higher plans handle this
|
|
|
|
|
// stop.
|
2015-07-23 19:55:02 +00:00
|
|
|
if (this_site->GetNumberOfOwners() == 1)
|
|
|
|
|
m_explains_stop = true;
|
|
|
|
|
else {
|
|
|
|
|
m_should_stop = true;
|
|
|
|
|
m_explains_stop = false;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
2015-07-23 19:55:02 +00:00
|
|
|
return;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2015-07-23 19:55:02 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2018-04-30 16:49:04 +00:00
|
|
|
// If we get here we haven't hit any of our breakpoints, so let the
|
|
|
|
|
// higher plans take care of the stop.
|
2015-07-23 19:55:02 +00:00
|
|
|
m_explains_stop = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
return;
|
2015-07-23 19:55:02 +00:00
|
|
|
} else if (IsUsuallyUnexplainedStopReason(reason)) {
|
|
|
|
|
m_explains_stop = false;
|
|
|
|
|
} else {
|
|
|
|
|
m_explains_stop = true;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
Figure out the reply to "PlanExplainsStop" once when we stop and then use the cached
value. This fixes problems, for instance, with the StepRange plans, where they know that
they explained the stop because they were at their "run to here" breakpoint, then deleted
that breakpoint, so when they got asked again, doh! I had done this for a couple of plans
in an ad hoc fashion, this just formalizes it.
Also add a "ResumeRequested" in Process so that the code in the completion handlers can
tell the ShouldStop logic they want to resume rather than just directly resuming. That allows
us to handle resuming in a more controlled fashion.
Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when
the target was immediately restarted.
--This line, and those below , will be ignored--
M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
M include/lldb/Target/ThreadList.h
M include/lldb/Target/ThreadPlanStepOut.h
M include/lldb/Target/Thread.h
M include/lldb/Target/ThreadPlanBase.h
M include/lldb/Target/ThreadPlanStepThrough.h
M include/lldb/Target/ThreadPlanStepInstruction.h
M include/lldb/Target/ThreadPlanStepInRange.h
M include/lldb/Target/ThreadPlanStepOverBreakpoint.h
M include/lldb/Target/ThreadPlanStepUntil.h
M include/lldb/Target/StopInfo.h
M include/lldb/Target/Process.h
M include/lldb/Target/ThreadPlanRunToAddress.h
M include/lldb/Target/ThreadPlan.h
M include/lldb/Target/ThreadPlanCallFunction.h
M include/lldb/Target/ThreadPlanStepOverRange.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M source/Target/StopInfo.cpp
M source/Target/Process.cpp
M source/Target/ThreadPlanRunToAddress.cpp
M source/Target/ThreadPlan.cpp
M source/Target/ThreadPlanCallFunction.cpp
M source/Target/ThreadPlanStepOverRange.cpp
M source/Target/ThreadList.cpp
M source/Target/ThreadPlanStepOut.cpp
M source/Target/Thread.cpp
M source/Target/ThreadPlanBase.cpp
M source/Target/ThreadPlanStepThrough.cpp
M source/Target/ThreadPlanStepInstruction.cpp
M source/Target/ThreadPlanStepInRange.cpp
M source/Target/ThreadPlanStepOverBreakpoint.cpp
M source/Target/ThreadPlanStepUntil.cpp
M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
llvm-svn: 181381
2013-05-08 00:35:16 +00:00
|
|
|
bool ThreadPlanStepUntil::DoPlanExplainsStop(Event *event_ptr) {
|
2010-06-08 16:52:24 +00:00
|
|
|
// We don't explain signals or breakpoints (breakpoints that handle stepping
|
2018-04-30 16:49:04 +00:00
|
|
|
// in or out will be handled by a child plan.
|
2010-06-08 16:52:24 +00:00
|
|
|
AnalyzeStop();
|
|
|
|
|
return m_explains_stop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ThreadPlanStepUntil::ShouldStop(Event *event_ptr) {
|
2018-04-30 16:49:04 +00:00
|
|
|
// If we've told our self in ExplainsStop that we plan to continue, then do
|
|
|
|
|
// so here. Otherwise, as long as this thread has stopped for a reason, we
|
|
|
|
|
// will stop.
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2013-06-04 01:40:51 +00:00
|
|
|
StopInfoSP stop_info_sp = GetPrivateStopInfo();
|
2012-08-09 00:50:26 +00:00
|
|
|
if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone)
|
2010-06-08 16:52:24 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
AnalyzeStop();
|
|
|
|
|
return m_should_stop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ThreadPlanStepUntil::StopOthers() { return m_stop_others; }
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
StateType ThreadPlanStepUntil::GetPlanRunState() { return eStateRunning; }
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Figure out the reply to "PlanExplainsStop" once when we stop and then use the cached
value. This fixes problems, for instance, with the StepRange plans, where they know that
they explained the stop because they were at their "run to here" breakpoint, then deleted
that breakpoint, so when they got asked again, doh! I had done this for a couple of plans
in an ad hoc fashion, this just formalizes it.
Also add a "ResumeRequested" in Process so that the code in the completion handlers can
tell the ShouldStop logic they want to resume rather than just directly resuming. That allows
us to handle resuming in a more controlled fashion.
Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when
the target was immediately restarted.
--This line, and those below , will be ignored--
M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
M include/lldb/Target/ThreadList.h
M include/lldb/Target/ThreadPlanStepOut.h
M include/lldb/Target/Thread.h
M include/lldb/Target/ThreadPlanBase.h
M include/lldb/Target/ThreadPlanStepThrough.h
M include/lldb/Target/ThreadPlanStepInstruction.h
M include/lldb/Target/ThreadPlanStepInRange.h
M include/lldb/Target/ThreadPlanStepOverBreakpoint.h
M include/lldb/Target/ThreadPlanStepUntil.h
M include/lldb/Target/StopInfo.h
M include/lldb/Target/Process.h
M include/lldb/Target/ThreadPlanRunToAddress.h
M include/lldb/Target/ThreadPlan.h
M include/lldb/Target/ThreadPlanCallFunction.h
M include/lldb/Target/ThreadPlanStepOverRange.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M source/Target/StopInfo.cpp
M source/Target/Process.cpp
M source/Target/ThreadPlanRunToAddress.cpp
M source/Target/ThreadPlan.cpp
M source/Target/ThreadPlanCallFunction.cpp
M source/Target/ThreadPlanStepOverRange.cpp
M source/Target/ThreadList.cpp
M source/Target/ThreadPlanStepOut.cpp
M source/Target/Thread.cpp
M source/Target/ThreadPlanBase.cpp
M source/Target/ThreadPlanStepThrough.cpp
M source/Target/ThreadPlanStepInstruction.cpp
M source/Target/ThreadPlanStepInRange.cpp
M source/Target/ThreadPlanStepOverBreakpoint.cpp
M source/Target/ThreadPlanStepUntil.cpp
M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
llvm-svn: 181381
2013-05-08 00:35:16 +00:00
|
|
|
bool ThreadPlanStepUntil::DoWillResume(StateType resume_state,
|
|
|
|
|
bool current_plan) {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (current_plan) {
|
2020-03-10 14:03:53 -07:00
|
|
|
Target &target = GetTarget();
|
|
|
|
|
Breakpoint *return_bp = target.GetBreakpointByID(m_return_bp_id).get();
|
|
|
|
|
if (return_bp != nullptr)
|
|
|
|
|
return_bp->SetEnabled(true);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2020-03-10 14:03:53 -07:00
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
|
|
|
|
Breakpoint *until_bp = target.GetBreakpointByID((*pos).second).get();
|
|
|
|
|
if (until_bp != nullptr)
|
|
|
|
|
until_bp->SetEnabled(true);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2010-11-11 19:26:09 +00:00
|
|
|
m_should_stop = true;
|
|
|
|
|
m_ran_analyze = false;
|
|
|
|
|
m_explains_stop = false;
|
2010-06-08 16:52:24 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
Figure out the reply to "PlanExplainsStop" once when we stop and then use the cached
value. This fixes problems, for instance, with the StepRange plans, where they know that
they explained the stop because they were at their "run to here" breakpoint, then deleted
that breakpoint, so when they got asked again, doh! I had done this for a couple of plans
in an ad hoc fashion, this just formalizes it.
Also add a "ResumeRequested" in Process so that the code in the completion handlers can
tell the ShouldStop logic they want to resume rather than just directly resuming. That allows
us to handle resuming in a more controlled fashion.
Also, SetPublicState can take a "restarted" flag, so that it doesn't drop the run lock when
the target was immediately restarted.
--This line, and those below , will be ignored--
M test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
M include/lldb/Target/ThreadList.h
M include/lldb/Target/ThreadPlanStepOut.h
M include/lldb/Target/Thread.h
M include/lldb/Target/ThreadPlanBase.h
M include/lldb/Target/ThreadPlanStepThrough.h
M include/lldb/Target/ThreadPlanStepInstruction.h
M include/lldb/Target/ThreadPlanStepInRange.h
M include/lldb/Target/ThreadPlanStepOverBreakpoint.h
M include/lldb/Target/ThreadPlanStepUntil.h
M include/lldb/Target/StopInfo.h
M include/lldb/Target/Process.h
M include/lldb/Target/ThreadPlanRunToAddress.h
M include/lldb/Target/ThreadPlan.h
M include/lldb/Target/ThreadPlanCallFunction.h
M include/lldb/Target/ThreadPlanStepOverRange.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
M source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
M source/Target/StopInfo.cpp
M source/Target/Process.cpp
M source/Target/ThreadPlanRunToAddress.cpp
M source/Target/ThreadPlan.cpp
M source/Target/ThreadPlanCallFunction.cpp
M source/Target/ThreadPlanStepOverRange.cpp
M source/Target/ThreadList.cpp
M source/Target/ThreadPlanStepOut.cpp
M source/Target/Thread.cpp
M source/Target/ThreadPlanBase.cpp
M source/Target/ThreadPlanStepThrough.cpp
M source/Target/ThreadPlanStepInstruction.cpp
M source/Target/ThreadPlanStepInRange.cpp
M source/Target/ThreadPlanStepOverBreakpoint.cpp
M source/Target/ThreadPlanStepUntil.cpp
M lldb.xcodeproj/xcshareddata/xcschemes/Run Testsuite.xcscheme
llvm-svn: 181381
2013-05-08 00:35:16 +00:00
|
|
|
bool ThreadPlanStepUntil::WillStop() {
|
2020-03-10 14:03:53 -07:00
|
|
|
Target &target = GetTarget();
|
|
|
|
|
Breakpoint *return_bp = target.GetBreakpointByID(m_return_bp_id).get();
|
|
|
|
|
if (return_bp != nullptr)
|
|
|
|
|
return_bp->SetEnabled(false);
|
|
|
|
|
|
|
|
|
|
until_collection::iterator pos, end = m_until_points.end();
|
|
|
|
|
for (pos = m_until_points.begin(); pos != end; pos++) {
|
|
|
|
|
Breakpoint *until_bp = target.GetBreakpointByID((*pos).second).get();
|
|
|
|
|
if (until_bp != nullptr)
|
|
|
|
|
until_bp->SetEnabled(false);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ThreadPlanStepUntil::MischiefManaged() {
|
2012-02-21 00:09:25 +00:00
|
|
|
// I'm letting "PlanExplainsStop" do all the work, and just reporting that
|
2016-09-06 20:57:50 +00:00
|
|
|
// here.
|
2010-06-08 16:52:24 +00:00
|
|
|
bool done = false;
|
2012-02-21 00:09:25 +00:00
|
|
|
if (IsPlanComplete()) {
|
2022-01-31 15:57:48 +01:00
|
|
|
Log *log = GetLog(LLDBLog::Step);
|
2019-07-24 17:56:10 +00:00
|
|
|
LLDB_LOGF(log, "Completed step until plan.");
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
Clear();
|
|
|
|
|
done = true;
|
|
|
|
|
}
|
|
|
|
|
if (done)
|
|
|
|
|
ThreadPlan::MischiefManaged();
|
|
|
|
|
|
|
|
|
|
return done;
|
|
|
|
|
}
|