[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
|
|
|
//===-- SBThreadPlan.cpp --------------------------------------------------===//
|
2014-09-30 07:17:18 +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
|
2014-09-30 07:17:18 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBThread.h"
|
2022-01-20 03:38:26 +08:00
|
|
|
#include "lldb/Utility/Instrumentation.h"
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
#include "lldb/API/SBFileSpec.h"
|
|
|
|
#include "lldb/API/SBStream.h"
|
2019-10-04 06:50:18 +08:00
|
|
|
#include "lldb/API/SBStructuredData.h"
|
2014-09-30 07:17:18 +08:00
|
|
|
#include "lldb/API/SBSymbolContext.h"
|
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
|
|
|
#include "lldb/Core/Debugger.h"
|
|
|
|
#include "lldb/Core/StreamFile.h"
|
2019-10-04 06:50:18 +08:00
|
|
|
#include "lldb/Core/StructuredDataImpl.h"
|
2014-09-30 07:17:18 +08:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
|
|
|
#include "lldb/Symbol/CompileUnit.h"
|
|
|
|
#include "lldb/Symbol/SymbolContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/Queue.h"
|
|
|
|
#include "lldb/Target/StopInfo.h"
|
|
|
|
#include "lldb/Target/SystemRuntime.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/ThreadPlan.h"
|
|
|
|
#include "lldb/Target/ThreadPlanPython.h"
|
|
|
|
#include "lldb/Target/ThreadPlanStepInRange.h"
|
|
|
|
#include "lldb/Target/ThreadPlanStepInstruction.h"
|
|
|
|
#include "lldb/Target/ThreadPlanStepOut.h"
|
|
|
|
#include "lldb/Target/ThreadPlanStepRange.h"
|
2018-08-07 19:07:21 +08:00
|
|
|
#include "lldb/Utility/State.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2017-06-27 18:45:31 +08:00
|
|
|
#include "lldb/Utility/StructuredData.h"
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBEvent.h"
|
|
|
|
#include "lldb/API/SBFrame.h"
|
|
|
|
#include "lldb/API/SBProcess.h"
|
|
|
|
#include "lldb/API/SBThreadPlan.h"
|
|
|
|
#include "lldb/API/SBValue.h"
|
|
|
|
|
2019-02-12 07:13:08 +08:00
|
|
|
#include <memory>
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
// Constructors
|
2022-01-20 03:38:26 +08:00
|
|
|
SBThreadPlan::SBThreadPlan() { LLDB_INSTRUMENT_VA(this); }
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(const ThreadPlanSP &lldb_object_sp)
|
2020-07-21 07:50:59 +08:00
|
|
|
: m_opaque_wp(lldb_object_sp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, lldb_object_sp);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(const SBThreadPlan &rhs)
|
2020-07-21 07:50:59 +08:00
|
|
|
: m_opaque_wp(rhs.m_opaque_wp) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_thread, class_name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
Thread *thread = sb_thread.get();
|
|
|
|
if (thread)
|
2021-11-25 21:01:41 +08:00
|
|
|
m_opaque_wp = std::make_shared<ThreadPlanPython>(*thread, class_name,
|
|
|
|
StructuredDataImpl());
|
2019-10-04 06:50:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name,
|
|
|
|
lldb::SBStructuredData &args_data) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_thread, class_name, args_data);
|
2019-10-04 06:50:18 +08:00
|
|
|
|
|
|
|
Thread *thread = sb_thread.get();
|
|
|
|
if (thread)
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp = std::make_shared<ThreadPlanPython>(*thread, class_name,
|
2021-11-25 21:01:41 +08:00
|
|
|
*args_data.m_impl_up);
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Assignment operator
|
|
|
|
|
|
|
|
const lldb::SBThreadPlan &SBThreadPlan::operator=(const SBThreadPlan &rhs) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, rhs);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (this != &rhs)
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2022-01-10 14:54:08 +08:00
|
|
|
return *this;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
// Destructor
|
2020-02-18 14:57:06 +08:00
|
|
|
SBThreadPlan::~SBThreadPlan() = default;
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBThreadPlan::IsValid() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBThreadPlan::operator bool() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
return static_cast<bool>(GetSP());
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::Clear() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp.reset();
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
lldb::StopReason SBThreadPlan::GetStopReason() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return eStopReasonNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t SBThreadPlan::GetStopReasonDataCount() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
uint64_t SBThreadPlan::GetStopReasonDataAtIndex(uint32_t idx) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, idx);
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThread SBThreadPlan::GetThread() const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThread(thread_plan_sp->GetThread().shared_from_this());
|
2014-09-30 07:17:18 +08:00
|
|
|
} else
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThread();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBThreadPlan::GetDescription(lldb::SBStream &description) const {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, description);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
|
|
|
thread_plan_sp->GetDescription(description.get(), eDescriptionLevelFull);
|
2014-09-30 07:17:18 +08:00
|
|
|
} else {
|
|
|
|
description.Printf("Empty SBThreadPlan");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
void SBThreadPlan::SetThreadPlan(const ThreadPlanSP &lldb_object_wp) {
|
|
|
|
m_opaque_wp = lldb_object_wp;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::SetPlanComplete(bool success) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, success);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
thread_plan_sp->SetPlanComplete(success);
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBThreadPlan::IsPlanComplete() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
return thread_plan_sp->IsPlanComplete();
|
|
|
|
return true;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
2016-08-06 06:06:12 +08:00
|
|
|
bool SBThreadPlan::IsPlanStale() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
return thread_plan_sp->IsPlanStale();
|
|
|
|
return true;
|
2016-08-06 06:06:12 +08:00
|
|
|
}
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
bool SBThreadPlan::IsValid() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
return thread_plan_sp->ValidatePlan(nullptr);
|
|
|
|
return false;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
2020-08-08 05:44:01 +08:00
|
|
|
bool SBThreadPlan::GetStopOthers() {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this);
|
2020-08-08 05:44:01 +08:00
|
|
|
|
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
return thread_plan_sp->StopOthers();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::SetStopOthers(bool stop_others) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, stop_others);
|
2020-08-08 05:44:01 +08:00
|
|
|
|
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
thread_plan_sp->SetStopOthers(stop_others);
|
|
|
|
}
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
// This section allows an SBThreadPlan to push another of the common types of
|
|
|
|
// plans...
|
|
|
|
//
|
|
|
|
// FIXME, you should only be able to queue thread plans from inside the methods
|
2018-05-01 00:49:04 +08:00
|
|
|
// of a Scripted Thread Plan. Need a way to enforce that.
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepOverRange(SBAddress &sb_start_address,
|
|
|
|
lldb::addr_t size) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_start_address, size);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2022-01-10 14:54:08 +08:00
|
|
|
return QueueThreadPlanForStepOverRange(sb_start_address, size, error);
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan SBThreadPlan::QueueThreadPlanForStepOverRange(
|
|
|
|
SBAddress &sb_start_address, lldb::addr_t size, SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_start_address, size, error);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2014-09-30 07:17:18 +08:00
|
|
|
Address *start_address = sb_start_address.get();
|
|
|
|
if (!start_address) {
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
AddressRange range(*start_address, size);
|
|
|
|
SymbolContext sc;
|
|
|
|
start_address->CalculateSymbolContext(&sc);
|
2018-11-15 09:18:15 +08:00
|
|
|
Status plan_status;
|
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan plan = SBThreadPlan(
|
|
|
|
thread_plan_sp->GetThread().QueueThreadPlanForStepOverRange(
|
2018-11-15 09:18:15 +08:00
|
|
|
false, range, sc, eAllThreads, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepInRange(SBAddress &sb_start_address,
|
|
|
|
lldb::addr_t size) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_start_address, size);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2022-01-10 14:54:08 +08:00
|
|
|
return QueueThreadPlanForStepInRange(sb_start_address, size, error);
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepInRange(SBAddress &sb_start_address,
|
|
|
|
lldb::addr_t size, SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_start_address, size, error);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2014-09-30 07:17:18 +08:00
|
|
|
Address *start_address = sb_start_address.get();
|
|
|
|
if (!start_address) {
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
AddressRange range(*start_address, size);
|
|
|
|
SymbolContext sc;
|
|
|
|
start_address->CalculateSymbolContext(&sc);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
|
|
|
Status plan_status;
|
|
|
|
SBThreadPlan plan =
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan(thread_plan_sp->GetThread().QueueThreadPlanForStepInRange(
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 19:14:47 +08:00
|
|
|
false, range, sc, nullptr, eAllThreads, plan_status));
|
2018-11-15 09:18:15 +08:00
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
|
|
|
|
bool first_insn) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, frame_idx_to_step_to, first_insn);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2022-01-10 14:54:08 +08:00
|
|
|
return QueueThreadPlanForStepOut(frame_idx_to_step_to, first_insn, error);
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
|
|
|
|
bool first_insn, SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, frame_idx_to_step_to, first_insn, error);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2014-09-30 07:17:18 +08:00
|
|
|
SymbolContext sc;
|
2020-07-21 07:50:59 +08:00
|
|
|
sc = thread_plan_sp->GetThread().GetStackFrameAtIndex(0)->GetSymbolContext(
|
2014-09-30 07:17:18 +08:00
|
|
|
lldb::eSymbolContextEverything);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
|
|
|
Status plan_status;
|
|
|
|
SBThreadPlan plan =
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan(thread_plan_sp->GetThread().QueueThreadPlanForStepOut(
|
2018-11-15 09:18:15 +08:00
|
|
|
false, &sc, first_insn, false, eVoteYes, eVoteNoOpinion,
|
|
|
|
frame_idx_to_step_to, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForRunToAddress(SBAddress sb_address) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_address);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2022-01-10 14:54:08 +08:00
|
|
|
return QueueThreadPlanForRunToAddress(sb_address, error);
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan SBThreadPlan::QueueThreadPlanForRunToAddress(SBAddress sb_address,
|
|
|
|
SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, sb_address, error);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2014-09-30 07:17:18 +08:00
|
|
|
Address *address = sb_address.get();
|
|
|
|
if (!address)
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
Status plan_status;
|
|
|
|
SBThreadPlan plan =
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan(thread_plan_sp->GetThread().QueueThreadPlanForRunToAddress(
|
2018-11-15 09:18:15 +08:00
|
|
|
false, *address, false, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2018-10-25 16:27:42 +08:00
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, script_class_name);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2022-01-10 14:54:08 +08:00
|
|
|
return QueueThreadPlanForStepScripted(script_class_name, error);
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
|
|
|
|
SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, script_class_name, error);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2018-11-15 09:18:15 +08:00
|
|
|
Status plan_status;
|
2019-10-04 06:50:18 +08:00
|
|
|
StructuredData::ObjectSP empty_args;
|
2018-11-15 09:18:15 +08:00
|
|
|
SBThreadPlan plan =
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan(thread_plan_sp->GetThread().QueueThreadPlanForStepScripted(
|
2019-10-04 06:50:18 +08:00
|
|
|
false, script_class_name, empty_args, false, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
2019-10-04 06:50:18 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2019-10-04 06:50:18 +08:00
|
|
|
}
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2019-10-04 06:50:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
|
|
|
|
lldb::SBStructuredData &args_data,
|
|
|
|
SBError &error) {
|
2022-01-20 03:38:26 +08:00
|
|
|
LLDB_INSTRUMENT_VA(this, script_class_name, args_data, error);
|
2019-10-04 06:50:18 +08:00
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2019-10-04 06:50:18 +08:00
|
|
|
Status plan_status;
|
|
|
|
StructuredData::ObjectSP args_obj = args_data.m_impl_up->GetObjectSP();
|
|
|
|
SBThreadPlan plan =
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThreadPlan(thread_plan_sp->GetThread().QueueThreadPlanForStepScripted(
|
2019-10-04 06:50:18 +08:00
|
|
|
false, script_class_name, args_obj, false, plan_status));
|
2018-11-15 09:18:15 +08:00
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
2020-04-11 06:37:05 +08:00
|
|
|
else
|
2020-07-21 07:50:59 +08:00
|
|
|
plan.GetSP()->SetPrivate(true);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
2022-01-10 14:54:08 +08:00
|
|
|
return plan;
|
2018-10-25 16:27:42 +08:00
|
|
|
} else {
|
2022-01-10 14:54:08 +08:00
|
|
|
return SBThreadPlan();
|
2018-10-25 16:27:42 +08:00
|
|
|
}
|
|
|
|
}
|