[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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2014-09-30 07:17:18 +08:00
|
|
|
#include "lldb/API/SBThread.h"
|
|
|
|
|
|
|
|
#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
|
2019-03-06 08:06:00 +08:00
|
|
|
SBThreadPlan::SBThreadPlan() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBThreadPlan); }
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(const ThreadPlanSP &lldb_object_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_sp(lldb_object_sp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBThreadPlan, (const lldb::ThreadPlanSP &),
|
|
|
|
lldb_object_sp);
|
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(const SBThreadPlan &rhs)
|
2019-03-06 08:06:00 +08:00
|
|
|
: m_opaque_sp(rhs.m_opaque_sp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBThreadPlan, (const lldb::SBThreadPlan &), rhs);
|
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBThreadPlan, (lldb::SBThread &, const char *),
|
|
|
|
sb_thread, class_name);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
Thread *thread = sb_thread.get();
|
|
|
|
if (thread)
|
2019-10-04 06:50:18 +08:00
|
|
|
m_opaque_sp = std::make_shared<ThreadPlanPython>(*thread, class_name,
|
|
|
|
nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan::SBThreadPlan(lldb::SBThread &sb_thread, const char *class_name,
|
|
|
|
lldb::SBStructuredData &args_data) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBThreadPlan, (lldb::SBThread &, const char *,
|
|
|
|
SBStructuredData &),
|
|
|
|
sb_thread, class_name, args_data);
|
|
|
|
|
|
|
|
Thread *thread = sb_thread.get();
|
|
|
|
if (thread)
|
|
|
|
m_opaque_sp = std::make_shared<ThreadPlanPython>(*thread, class_name,
|
|
|
|
args_data.m_impl_up.get());
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Assignment operator
|
|
|
|
|
|
|
|
const lldb::SBThreadPlan &SBThreadPlan::operator=(const SBThreadPlan &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBThreadPlan &,
|
|
|
|
SBThreadPlan, operator=,(const lldb::SBThreadPlan &), rhs);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_sp = rhs.m_opaque_sp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
// Destructor
|
|
|
|
SBThreadPlan::~SBThreadPlan() {}
|
|
|
|
|
Remove unneeded #ifdef SWIGs
Summary:
Some of these were present in files which should never be read by swig
(and we also had one in the interface file, which is only read by swig).
They are probably leftovers from the time when we were running swig over
lldb headers directly.
While writing this patch, I noticed that some of the #ifdefs were
guarding public functions that were operating on lldb_private data
types. While it wasn't strictly necessary for this patch, I made these
private, as nobody should really be accessing them. This can potentially
break existing code if it happened to use these methods, though it will
only break at build time -- if someone builds against an old header, he
should still be able to link to a new lldb library, since the functions
are still there.
We could keep these public for backward compatbility, but I would argue
that if anyone was actually using these functions for anything, his code
is already broken.
Reviewers: JDevlieghere, clayborg, jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D60400
llvm-svn: 357984
2019-04-09 17:03:43 +08:00
|
|
|
lldb_private::ThreadPlan *SBThreadPlan::get() { return m_opaque_sp.get(); }
|
2019-03-06 08:06:00 +08:00
|
|
|
|
|
|
|
bool SBThreadPlan::IsValid() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThreadPlan, IsValid);
|
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 {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBThreadPlan, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
[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
|
|
|
return m_opaque_sp.get() != nullptr;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBThreadPlan, Clear);
|
|
|
|
|
|
|
|
m_opaque_sp.reset();
|
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
lldb::StopReason SBThreadPlan::GetStopReason() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::StopReason, SBThreadPlan, GetStopReason);
|
2014-09-30 07:17:18 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return eStopReasonNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t SBThreadPlan::GetStopReasonDataCount() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBThreadPlan, GetStopReasonDataCount);
|
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) {
|
|
|
|
LLDB_RECORD_METHOD(uint64_t, SBThreadPlan, GetStopReasonDataAtIndex,
|
|
|
|
(uint32_t), 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 {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBThread, SBThreadPlan, GetThread);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
SBThread(m_opaque_sp->GetThread().shared_from_this()));
|
2014-09-30 07:17:18 +08:00
|
|
|
} else
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThread());
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBThreadPlan::GetDescription(lldb::SBStream &description) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBThreadPlan, GetDescription,
|
|
|
|
(lldb::SBStream &), description);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
|
|
|
m_opaque_sp->GetDescription(description.get(), eDescriptionLevelFull);
|
|
|
|
} else {
|
|
|
|
description.Printf("Empty SBThreadPlan");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::SetThreadPlan(const ThreadPlanSP &lldb_object_sp) {
|
|
|
|
m_opaque_sp = lldb_object_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::SetPlanComplete(bool success) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBThreadPlan, SetPlanComplete, (bool), success);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->SetPlanComplete(success);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SBThreadPlan::IsPlanComplete() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsPlanComplete);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->IsPlanComplete();
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-08-06 06:06:12 +08:00
|
|
|
bool SBThreadPlan::IsPlanStale() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsPlanStale);
|
|
|
|
|
2016-08-06 06:06:12 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->IsPlanStale();
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
bool SBThreadPlan::IsValid() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsValid);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->ValidatePlan(nullptr);
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOverRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t), sb_start_address, size);
|
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOverRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t, lldb::SBError &),
|
|
|
|
sb_start_address, size, error);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
|
|
|
Address *start_address = sb_start_address.get();
|
|
|
|
if (!start_address) {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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 =
|
|
|
|
SBThreadPlan(m_opaque_sp->GetThread().QueueThreadPlanForStepOverRange(
|
|
|
|
false, range, sc, eAllThreads, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepInRange(SBAddress &sb_start_address,
|
|
|
|
lldb::addr_t size) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepInRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t), sb_start_address, size);
|
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepInRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t, lldb::SBError &),
|
|
|
|
sb_start_address, size, error);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
|
|
|
Address *start_address = sb_start_address.get();
|
|
|
|
if (!start_address) {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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 =
|
|
|
|
SBThreadPlan(m_opaque_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());
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
|
|
|
|
bool first_insn) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOut, (uint32_t, bool),
|
|
|
|
frame_idx_to_step_to, first_insn);
|
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOut,
|
|
|
|
(uint32_t, bool, lldb::SBError &), frame_idx_to_step_to,
|
|
|
|
first_insn, error);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
|
|
|
SymbolContext sc;
|
|
|
|
sc = m_opaque_sp->GetThread().GetStackFrameAtIndex(0)->GetSymbolContext(
|
|
|
|
lldb::eSymbolContextEverything);
|
2018-11-15 09:18:15 +08:00
|
|
|
|
|
|
|
Status plan_status;
|
|
|
|
SBThreadPlan plan =
|
|
|
|
SBThreadPlan(m_opaque_sp->GetThread().QueueThreadPlanForStepOut(
|
|
|
|
false, &sc, first_insn, false, eVoteYes, eVoteNoOpinion,
|
|
|
|
frame_idx_to_step_to, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2014-09-30 07:17:18 +08:00
|
|
|
} else {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForRunToAddress(SBAddress sb_address) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForRunToAddress, (lldb::SBAddress),
|
|
|
|
sb_address);
|
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(QueueThreadPlanForRunToAddress(sb_address, error));
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan SBThreadPlan::QueueThreadPlanForRunToAddress(SBAddress sb_address,
|
|
|
|
SBError &error) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForRunToAddress,
|
|
|
|
(lldb::SBAddress, lldb::SBError &), sb_address, error);
|
|
|
|
|
2014-09-30 07:17:18 +08:00
|
|
|
if (m_opaque_sp) {
|
|
|
|
Address *address = sb_address.get();
|
|
|
|
if (!address)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
Status plan_status;
|
|
|
|
SBThreadPlan plan =
|
|
|
|
SBThreadPlan(m_opaque_sp->GetThread().QueueThreadPlanForRunToAddress(
|
|
|
|
false, *address, false, plan_status));
|
|
|
|
|
|
|
|
if (plan_status.Fail())
|
|
|
|
error.SetErrorString(plan_status.AsCString());
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2014-09-30 07:17:18 +08:00
|
|
|
} else {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted, (const char *),
|
|
|
|
script_class_name);
|
|
|
|
|
2018-11-15 09:18:15 +08:00
|
|
|
SBError error;
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
QueueThreadPlanForStepScripted(script_class_name, error));
|
2018-11-15 09:18:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
|
|
|
|
SBError &error) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted,
|
|
|
|
(const char *, lldb::SBError &), script_class_name, error);
|
|
|
|
|
2018-10-25 16:27:42 +08:00
|
|
|
if (m_opaque_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 =
|
|
|
|
SBThreadPlan(m_opaque_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());
|
|
|
|
|
|
|
|
return LLDB_RECORD_RESULT(plan);
|
|
|
|
} else {
|
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SBThreadPlan
|
|
|
|
SBThreadPlan::QueueThreadPlanForStepScripted(const char *script_class_name,
|
|
|
|
lldb::SBStructuredData &args_data,
|
|
|
|
SBError &error) {
|
|
|
|
LLDB_RECORD_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted,
|
|
|
|
(const char *, lldb::SBStructuredData &, lldb::SBError &),
|
|
|
|
script_class_name, args_data, error);
|
|
|
|
|
|
|
|
if (m_opaque_sp) {
|
|
|
|
Status plan_status;
|
|
|
|
StructuredData::ObjectSP args_obj = args_data.m_impl_up->GetObjectSP();
|
|
|
|
SBThreadPlan plan =
|
|
|
|
SBThreadPlan(m_opaque_sp->GetThread().QueueThreadPlanForStepScripted(
|
|
|
|
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());
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2018-10-25 16:27:42 +08:00
|
|
|
} else {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2018-10-25 16:27:42 +08:00
|
|
|
}
|
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBThreadPlan>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBThreadPlan, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBThreadPlan, (const lldb::ThreadPlanSP &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBThreadPlan, (const lldb::SBThreadPlan &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBThreadPlan, (lldb::SBThread &, const char *));
|
2019-10-04 06:50:18 +08:00
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBThreadPlan, (lldb::SBThread &, const char *,
|
|
|
|
lldb::SBStructuredData &));
|
2019-03-20 01:13:13 +08:00
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBThreadPlan &,
|
|
|
|
SBThreadPlan, operator=,(const lldb::SBThreadPlan &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBThreadPlan, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBThreadPlan, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBThreadPlan, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::StopReason, SBThreadPlan, GetStopReason, ());
|
|
|
|
LLDB_REGISTER_METHOD(size_t, SBThreadPlan, GetStopReasonDataCount, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint64_t, SBThreadPlan, GetStopReasonDataAtIndex,
|
|
|
|
(uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBThread, SBThreadPlan, GetThread, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBThreadPlan, GetDescription,
|
|
|
|
(lldb::SBStream &));
|
|
|
|
LLDB_REGISTER_METHOD(void, SBThreadPlan, SetPlanComplete, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsPlanComplete, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsPlanStale, ());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBThreadPlan, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOverRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOverRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t, lldb::SBError &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepInRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepInRange,
|
|
|
|
(lldb::SBAddress &, lldb::addr_t, lldb::SBError &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOut, (uint32_t, bool));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepOut,
|
|
|
|
(uint32_t, bool, lldb::SBError &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForRunToAddress, (lldb::SBAddress));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForRunToAddress,
|
|
|
|
(lldb::SBAddress, lldb::SBError &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted,
|
|
|
|
(const char *, lldb::SBError &));
|
2019-10-04 06:50:18 +08:00
|
|
|
LLDB_REGISTER_METHOD(lldb::SBThreadPlan, SBThreadPlan,
|
|
|
|
QueueThreadPlanForStepScripted,
|
|
|
|
(const char *, lldb::SBStructuredData &,
|
|
|
|
lldb::SBError &));
|
2019-03-20 01:13:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|