[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 15:23:27 +08:00
|
|
|
//===-- ThreadPlanStepThrough.cpp -----------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08: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-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-12-15 09:33:19 +08:00
|
|
|
#include "lldb/Target/ThreadPlanStepThrough.h"
|
2011-12-03 09:52:59 +08:00
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/DynamicLoader.h"
|
2019-05-31 06:00:18 +08:00
|
|
|
#include "lldb/Target/LanguageRuntime.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2011-12-03 09:52:59 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "lldb/Utility/Log.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
// ThreadPlanStepThrough: If the current instruction is a trampoline, step
|
2018-05-01 00:49:04 +08:00
|
|
|
// through it If it is the beginning of the prologue of a function, step
|
|
|
|
// through that as well.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2012-05-10 09:35:39 +08:00
|
|
|
ThreadPlanStepThrough::ThreadPlanStepThrough(Thread &thread,
|
|
|
|
StackID &m_stack_id,
|
|
|
|
bool stop_others)
|
2010-06-19 12:45:32 +08:00
|
|
|
: ThreadPlan(ThreadPlan::eKindStepThrough,
|
|
|
|
"Step through trampolines and prologues", thread,
|
|
|
|
eVoteNoOpinion, eVoteNoOpinion),
|
2011-12-03 09:52:59 +08:00
|
|
|
m_start_address(0), m_backstop_bkpt_id(LLDB_INVALID_BREAK_ID),
|
|
|
|
m_backstop_addr(LLDB_INVALID_ADDRESS), m_return_stack_id(m_stack_id),
|
2010-06-09 00:52:24 +08:00
|
|
|
m_stop_others(stop_others) {
|
2011-12-03 09:52:59 +08:00
|
|
|
LookForPlanToStepThroughFromCurrentPC();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
// If we don't get a valid step through plan, don't bother to set up a
|
|
|
|
// backstop.
|
|
|
|
if (m_sub_plan_sp) {
|
|
|
|
m_start_address = GetThread().GetRegisterContext()->GetPC(0);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
// We are going to return back to the concrete frame 1, we might pass by
|
2018-05-01 00:49:04 +08:00
|
|
|
// some inlined code that we're in the middle of by doing this, but it's
|
|
|
|
// easier than trying to figure out where the inlined code might return to.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-03-11 05:03:53 +08:00
|
|
|
StackFrameSP return_frame_sp = thread.GetFrameWithStackID(m_stack_id);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
if (return_frame_sp) {
|
2012-02-21 08:09:25 +08:00
|
|
|
m_backstop_addr = return_frame_sp->GetFrameCodeAddress().GetLoadAddress(
|
2020-03-11 05:03:53 +08:00
|
|
|
thread.CalculateTarget().get());
|
2013-10-12 03:48:25 +08:00
|
|
|
Breakpoint *return_bp =
|
2020-03-11 05:03:53 +08:00
|
|
|
m_process.GetTarget()
|
2013-10-12 03:48:25 +08:00
|
|
|
.CreateBreakpoint(m_backstop_addr, true, false)
|
|
|
|
.get();
|
2018-11-15 09:18:15 +08:00
|
|
|
|
2015-12-15 09:33:19 +08:00
|
|
|
if (return_bp != nullptr) {
|
2018-11-15 09:18:15 +08:00
|
|
|
if (return_bp->IsHardware() && !return_bp->HasResolvedLocations())
|
|
|
|
m_could_not_resolve_hw_bp = true;
|
2020-03-11 05:03:53 +08:00
|
|
|
return_bp->SetThreadID(m_tid);
|
2011-12-03 09:52:59 +08:00
|
|
|
m_backstop_bkpt_id = return_bp->GetID();
|
2013-01-26 10:19:28 +08:00
|
|
|
return_bp->SetBreakpointKind("step-through-backstop");
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
2011-12-03 09:52:59 +08:00
|
|
|
if (log) {
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Setting backstop breakpoint %d at address: 0x%" PRIx64,
|
|
|
|
m_backstop_bkpt_id, m_backstop_addr);
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlanStepThrough::~ThreadPlanStepThrough() { ClearBackstopBreakpoint(); }
|
2011-12-03 09:52:59 +08:00
|
|
|
|
|
|
|
void ThreadPlanStepThrough::DidPush() {
|
|
|
|
if (m_sub_plan_sp)
|
|
|
|
PushPlan(m_sub_plan_sp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadPlanStepThrough::LookForPlanToStepThroughFromCurrentPC() {
|
2020-03-11 05:03:53 +08:00
|
|
|
Thread &thread = GetThread();
|
|
|
|
DynamicLoader *loader = thread.GetProcess()->GetDynamicLoader();
|
2014-10-01 04:33:25 +08:00
|
|
|
if (loader)
|
2020-03-11 05:03:53 +08:00
|
|
|
m_sub_plan_sp = loader->GetStepThroughTrampolinePlan(thread, m_stop_others);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-05-31 06:00:18 +08:00
|
|
|
// If the DynamicLoader was unable to provide us with a ThreadPlan, then we
|
|
|
|
// try the LanguageRuntimes.
|
|
|
|
if (!m_sub_plan_sp) {
|
2020-03-11 05:03:53 +08:00
|
|
|
for (LanguageRuntime *runtime : m_process.GetLanguageRuntimes()) {
|
2011-12-03 09:52:59 +08:00
|
|
|
m_sub_plan_sp =
|
2020-03-11 05:03:53 +08:00
|
|
|
runtime->GetStepThroughTrampolinePlan(thread, m_stop_others);
|
2018-10-13 01:20:39 +08:00
|
|
|
|
2019-05-31 06:00:18 +08:00
|
|
|
if (m_sub_plan_sp)
|
|
|
|
break;
|
|
|
|
}
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
2011-12-03 09:52:59 +08:00
|
|
|
if (log) {
|
|
|
|
lldb::addr_t current_address = GetThread().GetRegisterContext()->GetPC(0);
|
|
|
|
if (m_sub_plan_sp) {
|
|
|
|
StreamString s;
|
|
|
|
m_sub_plan_sp->GetDescription(&s, lldb::eDescriptionLevelFull);
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Found step through plan from 0x%" PRIx64 ": %s",
|
|
|
|
current_address, s.GetData());
|
2011-12-03 09:52:59 +08:00
|
|
|
} else {
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log,
|
|
|
|
"Couldn't find step through plan from address 0x%" PRIx64 ".",
|
|
|
|
current_address);
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadPlanStepThrough::GetDescription(Stream *s,
|
|
|
|
lldb::DescriptionLevel level) {
|
|
|
|
if (level == lldb::eDescriptionLevelBrief)
|
|
|
|
s->Printf("Step through");
|
|
|
|
else {
|
2011-12-03 09:52:59 +08:00
|
|
|
s->PutCString("Stepping through trampoline code from: ");
|
2019-12-05 21:41:09 +08:00
|
|
|
DumpAddress(s->AsRawOstream(), m_start_address, sizeof(addr_t));
|
2011-12-03 09:52:59 +08:00
|
|
|
if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
|
2016-07-15 06:03:10 +08:00
|
|
|
s->Printf(" with backstop breakpoint ID: %d at address: ",
|
|
|
|
m_backstop_bkpt_id);
|
2019-12-05 21:41:09 +08:00
|
|
|
DumpAddress(s->AsRawOstream(), m_backstop_addr, sizeof(addr_t));
|
2011-12-03 09:52:59 +08:00
|
|
|
} else
|
|
|
|
s->PutCString(" unable to set a backstop breakpoint.");
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanStepThrough::ValidatePlan(Stream *error) {
|
2018-11-15 09:18:15 +08:00
|
|
|
if (m_could_not_resolve_hw_bp) {
|
|
|
|
if (error)
|
|
|
|
error->PutCString(
|
|
|
|
"Could not create hardware breakpoint for thread plan.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_backstop_bkpt_id == LLDB_INVALID_BREAK_ID) {
|
|
|
|
if (error)
|
|
|
|
error->PutCString("Could not create backstop breakpoint.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!m_sub_plan_sp.get()) {
|
|
|
|
if (error)
|
|
|
|
error->PutCString("Does not have a subplan.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2010-06-09 00:52:24 +08: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 08:35:16 +08:00
|
|
|
bool ThreadPlanStepThrough::DoPlanExplainsStop(Event *event_ptr) {
|
2011-12-03 09:52:59 +08:00
|
|
|
// If we have a sub-plan, it will have been asked first if we explain the
|
2018-05-01 00:49:04 +08:00
|
|
|
// stop, and we won't get asked. The only time we would be the one directly
|
|
|
|
// asked this question is if we hit our backstop breakpoint.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-12-15 09:33:19 +08:00
|
|
|
return HitOurBackstopBreakpoint();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanStepThrough::ShouldStop(Event *event_ptr) {
|
2011-12-03 09:52:59 +08:00
|
|
|
// If we've already marked ourselves done, then we're done...
|
|
|
|
if (IsPlanComplete())
|
2012-05-10 09:35:39 +08:00
|
|
|
return true;
|
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
// First, did we hit the backstop breakpoint?
|
2012-05-10 09:35:39 +08:00
|
|
|
if (HitOurBackstopBreakpoint()) {
|
|
|
|
SetPlanComplete(true);
|
|
|
|
return true;
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// If we don't have a sub-plan, then we're also done (can't see how we would
|
2018-05-01 00:49:04 +08:00
|
|
|
// ever get here without a plan, but just in case.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
if (!m_sub_plan_sp) {
|
2010-06-09 00:52:24 +08:00
|
|
|
SetPlanComplete();
|
2010-11-12 03:26:09 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-11-12 03:26:09 +08:00
|
|
|
// If the current sub plan is not done, we don't want to stop. Actually, we
|
2018-05-01 00:49:04 +08:00
|
|
|
// probably won't ever get here in this state, since we generally won't get
|
|
|
|
// asked any questions if out current sub-plan is not done...
|
2010-11-12 03:26:09 +08:00
|
|
|
if (!m_sub_plan_sp->IsPlanComplete())
|
2012-05-10 09:35:39 +08:00
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// If our current sub plan failed, then let's just run to our backstop. If
|
|
|
|
// we can't do that then just stop.
|
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 08:35:16 +08:00
|
|
|
if (!m_sub_plan_sp->PlanSucceeded()) {
|
|
|
|
if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
|
|
|
|
m_sub_plan_sp.reset();
|
2012-05-10 09:35:39 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
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 08:35:16 +08:00
|
|
|
SetPlanComplete(false);
|
2011-12-03 09:52:59 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08: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 08:35:16 +08:00
|
|
|
// Next see if there is a specific step through plan at our current pc (these
|
2018-05-01 00:49:04 +08:00
|
|
|
// might chain, for instance stepping through a dylib trampoline to the objc
|
2011-12-03 09:52:59 +08:00
|
|
|
// dispatch function...)
|
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 08:35:16 +08:00
|
|
|
LookForPlanToStepThroughFromCurrentPC();
|
2010-06-09 00:52:24 +08:00
|
|
|
if (m_sub_plan_sp) {
|
2011-12-03 09:52:59 +08:00
|
|
|
PushPlan(m_sub_plan_sp);
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2011-12-03 09:52:59 +08:00
|
|
|
SetPlanComplete();
|
2010-06-09 00:52:24 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanStepThrough::StopOthers() { return m_stop_others; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
StateType ThreadPlanStepThrough::GetPlanRunState() { return eStateRunning; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool ThreadPlanStepThrough::DoWillResume(StateType resume_state,
|
|
|
|
bool current_plan) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
bool ThreadPlanStepThrough::WillStop() { return true; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-05-10 09:35:39 +08:00
|
|
|
void ThreadPlanStepThrough::ClearBackstopBreakpoint() {
|
|
|
|
if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
|
2020-03-11 05:03:53 +08:00
|
|
|
m_process.GetTarget().RemoveBreakpointByID(m_backstop_bkpt_id);
|
2012-05-10 09:35:39 +08:00
|
|
|
m_backstop_bkpt_id = LLDB_INVALID_BREAK_ID;
|
2018-11-15 09:18:15 +08:00
|
|
|
m_could_not_resolve_hw_bp = false;
|
2012-05-10 09:35:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool ThreadPlanStepThrough::MischiefManaged() {
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
if (!IsPlanComplete()) {
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
|
|
|
} else {
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "Completed step through step plan.");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-05-10 09:35:39 +08:00
|
|
|
ClearBackstopBreakpoint();
|
2010-06-09 00:52:24 +08:00
|
|
|
ThreadPlan::MischiefManaged();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
bool ThreadPlanStepThrough::HitOurBackstopBreakpoint() {
|
2020-03-11 05:03:53 +08:00
|
|
|
Thread &thread = GetThread();
|
|
|
|
StopInfoSP stop_info_sp(thread.GetStopInfo());
|
2011-12-03 09:52:59 +08:00
|
|
|
if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint) {
|
|
|
|
break_id_t stop_value = (break_id_t)stop_info_sp->GetValue();
|
2012-02-21 08:09:25 +08:00
|
|
|
BreakpointSiteSP cur_site_sp =
|
2020-03-11 05:03:53 +08:00
|
|
|
m_process.GetBreakpointSiteList().FindByID(stop_value);
|
2011-12-03 09:52:59 +08:00
|
|
|
if (cur_site_sp &&
|
|
|
|
cur_site_sp->IsBreakpointAtThisSite(m_backstop_bkpt_id)) {
|
2020-03-11 05:03:53 +08:00
|
|
|
StackID cur_frame_zero_id = thread.GetStackFrameAtIndex(0)->GetStackID();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-05-10 09:35:39 +08:00
|
|
|
if (cur_frame_zero_id == m_return_stack_id) {
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
2011-12-03 09:52:59 +08:00
|
|
|
if (log)
|
|
|
|
log->PutCString("ThreadPlanStepThrough hit backstop breakpoint.");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-12-03 09:52:59 +08:00
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|