[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
|
|
|
//===-- QueueItem.cpp -----------------------------------------------------===//
|
2013-12-13 08:29:16 +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
|
2013-12-13 08:29:16 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/Queue.h"
|
2014-02-05 13:44:54 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
2013-12-13 08:29:16 +08:00
|
|
|
#include "lldb/Target/QueueItem.h"
|
2014-02-05 13:44:54 +08:00
|
|
|
#include "lldb/Target/SystemRuntime.h"
|
2013-12-13 08:29:16 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2014-03-10 16:42:03 +08:00
|
|
|
QueueItem::QueueItem(QueueSP queue_sp, ProcessSP process_sp,
|
|
|
|
lldb::addr_t item_ref, lldb_private::Address address)
|
2014-03-10 05:17:08 +08:00
|
|
|
: m_queue_wp(), m_process_wp(), m_item_ref(item_ref), m_address(address),
|
2014-03-10 16:42:03 +08:00
|
|
|
m_have_fetched_entire_item(false), m_kind(eQueueItemKindUnknown),
|
2014-02-05 13:44:54 +08:00
|
|
|
m_item_that_enqueued_this_ref(LLDB_INVALID_ADDRESS),
|
|
|
|
m_enqueueing_thread_id(LLDB_INVALID_THREAD_ID),
|
|
|
|
m_enqueueing_queue_id(LLDB_INVALID_QUEUE_ID),
|
|
|
|
m_target_queue_id(LLDB_INVALID_QUEUE_ID), m_stop_id(0), m_backtrace(),
|
|
|
|
m_thread_label(), m_queue_label(), m_target_queue_label() {
|
2013-12-18 08:58:23 +08:00
|
|
|
m_queue_wp = queue_sp;
|
2014-03-10 16:42:03 +08:00
|
|
|
m_process_wp = process_sp;
|
2013-12-13 08:29:16 +08:00
|
|
|
}
|
|
|
|
|
2021-07-03 02:27:37 +08:00
|
|
|
QueueItem::~QueueItem() = default;
|
2013-12-13 08:29:16 +08:00
|
|
|
|
2014-03-10 16:42:03 +08:00
|
|
|
QueueItemKind QueueItem::GetKind() {
|
|
|
|
FetchEntireItem();
|
2013-12-13 08:29:16 +08:00
|
|
|
return m_kind;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QueueItem::SetKind(QueueItemKind item_kind) { m_kind = item_kind; }
|
|
|
|
|
|
|
|
Address &QueueItem::GetAddress() { return m_address; }
|
|
|
|
|
|
|
|
void QueueItem::SetAddress(Address addr) { m_address = addr; }
|
|
|
|
|
|
|
|
ThreadSP QueueItem::GetExtendedBacktraceThread(ConstString type) {
|
2014-03-10 16:42:03 +08:00
|
|
|
FetchEntireItem();
|
2014-02-05 13:44:54 +08:00
|
|
|
ThreadSP return_thread;
|
|
|
|
QueueSP queue_sp = m_queue_wp.lock();
|
|
|
|
if (queue_sp) {
|
|
|
|
ProcessSP process_sp = queue_sp->GetProcess();
|
|
|
|
if (process_sp && process_sp->GetSystemRuntime()) {
|
|
|
|
return_thread =
|
|
|
|
process_sp->GetSystemRuntime()->GetExtendedBacktraceForQueueItem(
|
|
|
|
this->shared_from_this(), type);
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-02-05 13:44:54 +08:00
|
|
|
return return_thread;
|
2013-12-13 08:29:16 +08:00
|
|
|
}
|
2014-03-06 14:31:18 +08:00
|
|
|
|
2014-03-10 16:42:03 +08:00
|
|
|
lldb::addr_t QueueItem::GetItemThatEnqueuedThis() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_item_that_enqueued_this_ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::tid_t QueueItem::GetEnqueueingThreadID() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_enqueueing_thread_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::queue_id_t QueueItem::GetEnqueueingQueueID() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_enqueueing_queue_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t QueueItem::GetStopID() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_stop_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<lldb::addr_t> &QueueItem::GetEnqueueingBacktrace() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_backtrace;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string QueueItem::GetThreadLabel() {
|
|
|
|
FetchEntireItem();
|
|
|
|
return m_thread_label;
|
|
|
|
}
|
|
|
|
|
2014-03-06 14:31:18 +08:00
|
|
|
std::string QueueItem::GetQueueLabel() {
|
2014-03-10 16:42:03 +08:00
|
|
|
FetchEntireItem();
|
|
|
|
return m_queue_label;
|
|
|
|
}
|
|
|
|
|
|
|
|
ProcessSP QueueItem::GetProcessSP() { return m_process_wp.lock(); }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-03-10 16:42:03 +08:00
|
|
|
void QueueItem::FetchEntireItem() {
|
2018-12-15 08:15:33 +08:00
|
|
|
if (m_have_fetched_entire_item)
|
2014-03-10 16:42:03 +08:00
|
|
|
return;
|
|
|
|
ProcessSP process_sp = m_process_wp.lock();
|
|
|
|
if (process_sp) {
|
|
|
|
SystemRuntime *runtime = process_sp->GetSystemRuntime();
|
|
|
|
if (runtime) {
|
|
|
|
runtime->CompleteQueueItem(this, m_item_ref);
|
|
|
|
m_have_fetched_entire_item = true;
|
2014-03-06 14:31:18 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2014-03-06 14:31:18 +08:00
|
|
|
}
|