[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
|
|
|
//===-- ThreadPlanCallOnFunctionExit.cpp ----------------------------------===//
|
2016-08-19 12:21:48 +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
|
2016-08-19 12:21:48 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/ThreadPlanCallOnFunctionExit.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
ThreadPlanCallOnFunctionExit::ThreadPlanCallOnFunctionExit(
|
|
|
|
Thread &thread, const Callback &callback)
|
|
|
|
: ThreadPlan(ThreadPlanKind::eKindGeneric, "CallOnFunctionExit", thread,
|
|
|
|
eVoteNoOpinion, eVoteNoOpinion // TODO check with Jim on these
|
|
|
|
),
|
|
|
|
m_callback(callback) {
|
|
|
|
// We are not a user-generated plan.
|
|
|
|
SetIsMasterPlan(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadPlanCallOnFunctionExit::DidPush() {
|
2018-05-01 00:49:04 +08:00
|
|
|
// We now want to queue the "step out" thread plan so it executes and
|
|
|
|
// completes.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-19 12:21:48 +08:00
|
|
|
// Set stop vote to eVoteNo.
|
2018-11-15 09:18:15 +08:00
|
|
|
Status status;
|
2016-08-19 12:21:48 +08:00
|
|
|
m_step_out_threadplan_sp = GetThread().QueueThreadPlanForStepOut(
|
|
|
|
false, // abort other plans
|
|
|
|
nullptr, // addr_context
|
|
|
|
true, // first instruction
|
|
|
|
true, // stop other threads
|
|
|
|
eVoteNo, // do not say "we're stopping"
|
2018-11-15 09:18:15 +08:00
|
|
|
eVoteNoOpinion, // don't care about run state broadcasting
|
2016-08-19 12:21:48 +08:00
|
|
|
0, // frame_idx
|
2018-11-15 09:18:15 +08:00
|
|
|
status, // status
|
2016-08-19 12:21:48 +08:00
|
|
|
eLazyBoolCalculate // avoid code w/o debinfo
|
2018-11-15 09:18:15 +08:00
|
|
|
);
|
2016-08-19 12:21:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ThreadPlan API
|
|
|
|
|
|
|
|
void ThreadPlanCallOnFunctionExit::GetDescription(
|
|
|
|
Stream *s, lldb::DescriptionLevel level) {
|
|
|
|
if (!s)
|
|
|
|
return;
|
|
|
|
s->Printf("Running until completion of current function, then making "
|
|
|
|
"callback.");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanCallOnFunctionExit::ValidatePlan(Stream *error) {
|
|
|
|
// We'll say we're always good since I don't know what would make this
|
|
|
|
// invalid.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanCallOnFunctionExit::ShouldStop(Event *event_ptr) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If this is where we find out that an internal stop came in, then: Check if
|
|
|
|
// the step-out plan completed. If it did, then we want to run the callback
|
|
|
|
// here (our reason for living...)
|
2016-08-19 12:21:48 +08:00
|
|
|
if (m_step_out_threadplan_sp && m_step_out_threadplan_sp->IsPlanComplete()) {
|
|
|
|
m_callback();
|
|
|
|
|
|
|
|
// We no longer need the pointer to the step-out thread plan.
|
|
|
|
m_step_out_threadplan_sp.reset();
|
|
|
|
|
|
|
|
// Indicate that this plan is done and can be discarded.
|
|
|
|
SetPlanComplete();
|
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// We're done now, but we want to return false so that we don't cause the
|
|
|
|
// thread to really stop.
|
2016-08-19 12:21:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanCallOnFunctionExit::WillStop() {
|
|
|
|
// The code looks like the return value is ignored via ThreadList::
|
2018-05-01 00:49:04 +08:00
|
|
|
// ShouldStop(). This is called when we really are going to stop. We don't
|
|
|
|
// care and don't need to do anything here.
|
2016-08-19 12:21:48 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadPlanCallOnFunctionExit::DoPlanExplainsStop(Event *event_ptr) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// We don't ever explain a stop. The only stop that is relevant to us
|
|
|
|
// directly is the step_out plan we added to do the heavy lifting of getting
|
|
|
|
// us past the current method.
|
2016-08-19 12:21:48 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::StateType ThreadPlanCallOnFunctionExit::GetPlanRunState() {
|
2018-05-01 00:49:04 +08:00
|
|
|
// This value doesn't matter - we'll never be the top thread plan, so nobody
|
|
|
|
// will ask us this question.
|
2016-08-19 12:21:48 +08:00
|
|
|
return eStateRunning;
|
|
|
|
}
|