[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)
|
2020-07-21 07:50:59 +08:00
|
|
|
: m_opaque_wp(lldb_object_sp) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBThreadPlan, (const lldb::ThreadPlanSP &),
|
|
|
|
lldb_object_sp);
|
|
|
|
}
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
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)
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp =
|
|
|
|
std::make_shared<ThreadPlanPython>(*thread, class_name, nullptr);
|
2019-10-04 06:50:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp = std::make_shared<ThreadPlanPython>(*thread, class_name,
|
2019-10-04 06:50:18 +08:00
|
|
|
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)
|
2020-07-21 07:50:59 +08:00
|
|
|
m_opaque_wp = rhs.m_opaque_wp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*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 {
|
|
|
|
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
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
return static_cast<bool>(GetSP());
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBThreadPlan, Clear);
|
|
|
|
|
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() {
|
|
|
|
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);
|
|
|
|
|
2020-07-21 07:50:59 +08:00
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp) {
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(
|
2020-07-21 07:50:59 +08:00
|
|
|
SBThread(thread_plan_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);
|
|
|
|
|
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) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(void, SBThreadPlan, SetPlanComplete, (bool), success);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsPlanComplete);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsPlanStale);
|
|
|
|
|
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() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, IsValid);
|
|
|
|
|
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() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(bool, SBThreadPlan, GetStopOthers);
|
|
|
|
|
|
|
|
ThreadPlanSP thread_plan_sp(GetSP());
|
|
|
|
if (thread_plan_sp)
|
|
|
|
return thread_plan_sp->StopOthers();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SBThreadPlan::SetStopOthers(bool stop_others) {
|
|
|
|
LLDB_RECORD_METHOD(void, SBThreadPlan, SetStopOthers, (bool), stop_others);
|
|
|
|
|
|
|
|
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) {
|
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);
|
|
|
|
|
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) {
|
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;
|
|
|
|
|
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);
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2020-07-21 07:50:59 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
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);
|
|
|
|
|
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) {
|
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 =
|
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
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2020-07-21 07:50:59 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
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);
|
|
|
|
|
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
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2020-07-21 07:50:59 +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);
|
|
|
|
|
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)
|
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 =
|
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
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(plan);
|
2014-09-30 07:17:18 +08:00
|
|
|
}
|
2020-07-21 07:50:59 +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);
|
|
|
|
|
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
|
|
|
|
|
|
|
return LLDB_RECORD_RESULT(plan);
|
|
|
|
}
|
2020-07-21 07:50:59 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBThreadPlan());
|
2019-10-04 06:50:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
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
|
|
|
|
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, ());
|
2020-08-08 05:44:01 +08:00
|
|
|
LLDB_REGISTER_METHOD(void, SBThreadPlan, SetStopOthers, (bool));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBThreadPlan, GetStopOthers, ());
|
2019-03-20 01:13:13 +08:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|