diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
commit | 5f29bb8a675e8f96452b632e7129113f7dec850e (patch) | |
tree | 3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /source/Plugins/Process/Utility | |
parent | 88c643b6fec27eec436c8d138fee6346e92337d6 (diff) | |
download | src-5f29bb8a675e8f96452b632e7129113f7dec850e.tar.gz src-5f29bb8a675e8f96452b632e7129113f7dec850e.zip |
Vendor import of stripped lldb trunk r366426 (just before the release_90
branch point):
https://llvm.org/svn/llvm-project/lldb/trunk@366426
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=351290
Diffstat (limited to 'source/Plugins/Process/Utility')
129 files changed, 907 insertions, 977 deletions
diff --git a/source/Plugins/Process/Utility/ARMDefines.h b/source/Plugins/Process/Utility/ARMDefines.h index 84c2cf19be7b..1f7eb54d10e7 100644 --- a/source/Plugins/Process/Utility/ARMDefines.h +++ b/source/Plugins/Process/Utility/ARMDefines.h @@ -1,15 +1,16 @@ -//===-- lldb_ARMDefines.h ---------------------------------------*- C++ -*-===// +//===-- ARMDefines.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// #ifndef lldb_ARMDefines_h_ #define lldb_ARMDefines_h_ +#include "llvm/Support/ErrorHandling.h" + #include <cassert> #include <cstdint> @@ -18,14 +19,14 @@ namespace lldb_private { // ARM shifter types -typedef enum { +enum ARM_ShifterType { SRType_LSL, SRType_LSR, SRType_ASR, SRType_ROR, SRType_RRX, SRType_Invalid -} ARM_ShifterType; +}; // ARM conditions // Meaning (integer) Meaning (floating-point) // Condition flags @@ -69,8 +70,6 @@ typedef enum { static inline const char *ARMCondCodeToString(uint32_t CC) { switch (CC) { - default: - assert(0 && "Unknown condition code"); case COND_EQ: return "eq"; case COND_NE: @@ -102,6 +101,7 @@ static inline const char *ARMCondCodeToString(uint32_t CC) { case COND_AL: return "al"; } + llvm_unreachable("Unknown condition code"); } static inline bool ARMConditionPassed(const uint32_t condition, diff --git a/source/Plugins/Process/Utility/ARMUtils.h b/source/Plugins/Process/Utility/ARMUtils.h index 2c14dc936cbc..d860348818d3 100644 --- a/source/Plugins/Process/Utility/ARMUtils.h +++ b/source/Plugins/Process/Utility/ARMUtils.h @@ -1,9 +1,8 @@ //===-- ARMUtils.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/AuxVector.cpp b/source/Plugins/Process/Utility/AuxVector.cpp new file mode 100644 index 000000000000..aab164ff93a6 --- /dev/null +++ b/source/Plugins/Process/Utility/AuxVector.cpp @@ -0,0 +1,96 @@ +//===-- AuxVector.cpp -------------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "AuxVector.h" + +AuxVector::AuxVector(const lldb_private::DataExtractor &data) { + ParseAuxv(data); +} + +void AuxVector::ParseAuxv(const lldb_private::DataExtractor &data) { + lldb::offset_t offset = 0; + const size_t value_type_size = data.GetAddressByteSize() * 2; + while (data.ValidOffsetForDataOfSize(offset, value_type_size)) { + // We're not reading an address but an int that could be 32 or 64 bit + // depending on the address size, which is what GetAddress does. + const uint64_t type = data.GetAddress(&offset); + const uint64_t value = data.GetAddress(&offset); + if (type == AUXV_AT_NULL) + break; + if (type == AUXV_AT_IGNORE) + continue; + + m_auxv_entries[type] = value; + } +} + +llvm::Optional<uint64_t> +AuxVector::GetAuxValue(enum EntryType entry_type) const { + auto it = m_auxv_entries.find(static_cast<uint64_t>(entry_type)); + if (it != m_auxv_entries.end()) + return it->second; + return llvm::None; +} + +void AuxVector::DumpToLog(lldb_private::Log *log) const { + if (!log) + return; + + log->PutCString("AuxVector: "); + for (auto entry : m_auxv_entries) { + log->Printf(" %s [%" PRIu64 "]: %" PRIx64, + GetEntryName(static_cast<EntryType>(entry.first)), entry.first, + entry.second); + } +} + +const char *AuxVector::GetEntryName(EntryType type) const { + const char *name = "AT_???"; + +#define ENTRY_NAME(_type) \ + _type: \ + name = &#_type[5] + switch (type) { + case ENTRY_NAME(AUXV_AT_NULL); break; + case ENTRY_NAME(AUXV_AT_IGNORE); break; + case ENTRY_NAME(AUXV_AT_EXECFD); break; + case ENTRY_NAME(AUXV_AT_PHDR); break; + case ENTRY_NAME(AUXV_AT_PHENT); break; + case ENTRY_NAME(AUXV_AT_PHNUM); break; + case ENTRY_NAME(AUXV_AT_PAGESZ); break; + case ENTRY_NAME(AUXV_AT_BASE); break; + case ENTRY_NAME(AUXV_AT_FLAGS); break; + case ENTRY_NAME(AUXV_AT_ENTRY); break; + case ENTRY_NAME(AUXV_AT_NOTELF); break; + case ENTRY_NAME(AUXV_AT_UID); break; + case ENTRY_NAME(AUXV_AT_EUID); break; + case ENTRY_NAME(AUXV_AT_GID); break; + case ENTRY_NAME(AUXV_AT_EGID); break; + case ENTRY_NAME(AUXV_AT_CLKTCK); break; + case ENTRY_NAME(AUXV_AT_PLATFORM); break; + case ENTRY_NAME(AUXV_AT_HWCAP); break; + case ENTRY_NAME(AUXV_AT_FPUCW); break; + case ENTRY_NAME(AUXV_AT_DCACHEBSIZE); break; + case ENTRY_NAME(AUXV_AT_ICACHEBSIZE); break; + case ENTRY_NAME(AUXV_AT_UCACHEBSIZE); break; + case ENTRY_NAME(AUXV_AT_IGNOREPPC); break; + case ENTRY_NAME(AUXV_AT_SECURE); break; + case ENTRY_NAME(AUXV_AT_BASE_PLATFORM); break; + case ENTRY_NAME(AUXV_AT_RANDOM); break; + case ENTRY_NAME(AUXV_AT_EXECFN); break; + case ENTRY_NAME(AUXV_AT_SYSINFO); break; + case ENTRY_NAME(AUXV_AT_SYSINFO_EHDR); break; + case ENTRY_NAME(AUXV_AT_L1I_CACHESHAPE); break; + case ENTRY_NAME(AUXV_AT_L1D_CACHESHAPE); break; + case ENTRY_NAME(AUXV_AT_L2_CACHESHAPE); break; + case ENTRY_NAME(AUXV_AT_L3_CACHESHAPE); break; + } +#undef ENTRY_NAME + + return name; +} diff --git a/source/Plugins/Process/Utility/AuxVector.h b/source/Plugins/Process/Utility/AuxVector.h new file mode 100644 index 000000000000..c16be68aedb1 --- /dev/null +++ b/source/Plugins/Process/Utility/AuxVector.h @@ -0,0 +1,73 @@ +//===-- AuxVector.h ---------------------------------------------*- C++ -*-===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_AuxVector_H_ +#define liblldb_AuxVector_H_ + +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Log.h" +#include <unordered_map> + +class AuxVector { + +public: + AuxVector(const lldb_private::DataExtractor &data); + + /// Constants describing the type of entry. + /// On Linux, running "LD_SHOW_AUXV=1 ./executable" will spew AUX + /// information. Added AUXV prefix to avoid potential conflicts with system- + /// defined macros + enum EntryType { + AUXV_AT_NULL = 0, ///< End of auxv. + AUXV_AT_IGNORE = 1, ///< Ignore entry. + AUXV_AT_EXECFD = 2, ///< File descriptor of program. + AUXV_AT_PHDR = 3, ///< Program headers. + AUXV_AT_PHENT = 4, ///< Size of program header. + AUXV_AT_PHNUM = 5, ///< Number of program headers. + AUXV_AT_PAGESZ = 6, ///< Page size. + AUXV_AT_BASE = 7, ///< Interpreter base address. + AUXV_AT_FLAGS = 8, ///< Flags. + AUXV_AT_ENTRY = 9, ///< Program entry point. + AUXV_AT_NOTELF = 10, ///< Set if program is not an ELF. + AUXV_AT_UID = 11, ///< UID. + AUXV_AT_EUID = 12, ///< Effective UID. + AUXV_AT_GID = 13, ///< GID. + AUXV_AT_EGID = 14, ///< Effective GID. + AUXV_AT_CLKTCK = 17, ///< Clock frequency (e.g. times(2)). + AUXV_AT_PLATFORM = 15, ///< String identifying platform. + AUXV_AT_HWCAP = + 16, ///< Machine dependent hints about processor capabilities. + AUXV_AT_FPUCW = 18, ///< Used FPU control word. + AUXV_AT_DCACHEBSIZE = 19, ///< Data cache block size. + AUXV_AT_ICACHEBSIZE = 20, ///< Instruction cache block size. + AUXV_AT_UCACHEBSIZE = 21, ///< Unified cache block size. + AUXV_AT_IGNOREPPC = 22, ///< Entry should be ignored. + AUXV_AT_SECURE = 23, ///< Boolean, was exec setuid-like? + AUXV_AT_BASE_PLATFORM = 24, ///< String identifying real platforms. + AUXV_AT_RANDOM = 25, ///< Address of 16 random bytes. + AUXV_AT_EXECFN = 31, ///< Filename of executable. + AUXV_AT_SYSINFO = 32, ///< Pointer to the global system page used for system + /// calls and other nice things. + AUXV_AT_SYSINFO_EHDR = 33, + AUXV_AT_L1I_CACHESHAPE = 34, ///< Shapes of the caches. + AUXV_AT_L1D_CACHESHAPE = 35, + AUXV_AT_L2_CACHESHAPE = 36, + AUXV_AT_L3_CACHESHAPE = 37, + }; + + llvm::Optional<uint64_t> GetAuxValue(enum EntryType entry_type) const; + void DumpToLog(lldb_private::Log *log) const; + const char *GetEntryName(EntryType type) const; + +private: + void ParseAuxv(const lldb_private::DataExtractor &data); + + std::unordered_map<uint64_t, uint64_t> m_auxv_entries; +}; + +#endif diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp index dcbf474fa55a..1afe4d920599 100644 --- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -1,9 +1,8 @@ //===-- DynamicRegisterInfo.cpp ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -68,7 +67,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict, for (uint32_t i = 0; i < num_sets; ++i) { ConstString set_name; if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) { - m_sets.push_back({ set_name.AsCString(), NULL, 0, NULL }); + m_sets.push_back({set_name.AsCString(), nullptr, 0, nullptr}); } else { Clear(); printf("error: register sets must have valid names\n"); @@ -303,7 +302,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict, llvm::StringRef format_str; if (reg_info_dict->GetValueForKeyAsString("format", format_str, nullptr)) { if (OptionArgParser::ToFormat(format_str.str().c_str(), reg_info.format, - NULL) + nullptr) .Fail()) { Clear(); printf("error: invalid 'format' value in register dictionary\n"); @@ -415,7 +414,7 @@ void DynamicRegisterInfo::AddRegister(RegisterInfo ®_info, const uint32_t reg_num = m_regs.size(); reg_info.name = reg_name.AsCString(); assert(reg_info.name); - reg_info.alt_name = reg_alt_name.AsCString(NULL); + reg_info.alt_name = reg_alt_name.AsCString(nullptr); uint32_t i; if (reg_info.value_regs) { for (i = 0; reg_info.value_regs[i] != LLDB_INVALID_REGNUM; ++i) @@ -481,7 +480,7 @@ void DynamicRegisterInfo::Finalize(const ArchSpec &arch) { if (m_value_regs_map.find(i) != m_value_regs_map.end()) m_regs[i].value_regs = m_value_regs_map[i].data(); else - m_regs[i].value_regs = NULL; + m_regs[i].value_regs = nullptr; } // Expand all invalidation dependencies @@ -530,7 +529,7 @@ void DynamicRegisterInfo::Finalize(const ArchSpec &arch) { if (m_invalidate_regs_map.find(i) != m_invalidate_regs_map.end()) m_regs[i].invalidate_regs = m_invalidate_regs_map[i].data(); else - m_regs[i].invalidate_regs = NULL; + m_regs[i].invalidate_regs = nullptr; } // Check if we need to automatically set the generic registers in case they @@ -640,19 +639,19 @@ const RegisterInfo * DynamicRegisterInfo::GetRegisterInfoAtIndex(uint32_t i) const { if (i < m_regs.size()) return &m_regs[i]; - return NULL; + return nullptr; } RegisterInfo *DynamicRegisterInfo::GetRegisterInfoAtIndex(uint32_t i) { if (i < m_regs.size()) return &m_regs[i]; - return NULL; + return nullptr; } const RegisterSet *DynamicRegisterInfo::GetRegisterSet(uint32_t i) const { if (i < m_sets.size()) return &m_sets[i]; - return NULL; + return nullptr; } uint32_t DynamicRegisterInfo::GetRegisterSetIndexByName(ConstString &set_name, @@ -665,7 +664,7 @@ uint32_t DynamicRegisterInfo::GetRegisterSetIndexByName(ConstString &set_name, m_set_names.push_back(set_name); m_set_reg_nums.resize(m_set_reg_nums.size() + 1); - RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL}; + RegisterSet new_set = {set_name.AsCString(), nullptr, 0, nullptr}; m_sets.push_back(new_set); return m_sets.size() - 1; } @@ -747,7 +746,7 @@ void DynamicRegisterInfo::Dump() const { } const lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo( - const lldb_private::ConstString ®_name) const { + lldb_private::ConstString reg_name) const { for (auto ®_info : m_regs) { // We can use pointer comparison since we used a ConstString to set the // "name" member in AddRegister() @@ -755,5 +754,5 @@ const lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo( return ®_info; } } - return NULL; + return nullptr; } diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.h b/source/Plugins/Process/Utility/DynamicRegisterInfo.h index 68f3902e0c96..aacf547e187d 100644 --- a/source/Plugins/Process/Utility/DynamicRegisterInfo.h +++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.h @@ -1,9 +1,8 @@ //===-- DynamicRegisterInfo.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -65,9 +64,7 @@ public: void Clear(); protected: - //------------------------------------------------------------------ // Classes that inherit from DynamicRegisterInfo can see and modify these - //------------------------------------------------------------------ typedef std::vector<lldb_private::RegisterInfo> reg_collection; typedef std::vector<lldb_private::RegisterSet> set_collection; typedef std::vector<uint32_t> reg_num_collection; @@ -78,7 +75,7 @@ protected: typedef std::map<uint32_t, dwarf_opcode> dynamic_reg_size_map; const lldb_private::RegisterInfo * - GetRegisterInfo(const lldb_private::ConstString ®_name) const; + GetRegisterInfo(lldb_private::ConstString reg_name) const; void MoveFrom(DynamicRegisterInfo &&info); diff --git a/source/Plugins/Process/Utility/FreeBSDSignals.cpp b/source/Plugins/Process/Utility/FreeBSDSignals.cpp index 0b56b6093559..9f63a594e054 100644 --- a/source/Plugins/Process/Utility/FreeBSDSignals.cpp +++ b/source/Plugins/Process/Utility/FreeBSDSignals.cpp @@ -1,9 +1,8 @@ //===-- FreeBSDSignals.cpp --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/FreeBSDSignals.h b/source/Plugins/Process/Utility/FreeBSDSignals.h index 174025cabb82..75462f3c76ff 100644 --- a/source/Plugins/Process/Utility/FreeBSDSignals.h +++ b/source/Plugins/Process/Utility/FreeBSDSignals.h @@ -1,9 +1,8 @@ //===-- FreeBSDSignals.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/GDBRemoteSignals.cpp b/source/Plugins/Process/Utility/GDBRemoteSignals.cpp index cc0537c2a8b3..ed35273ce3fe 100644 --- a/source/Plugins/Process/Utility/GDBRemoteSignals.cpp +++ b/source/Plugins/Process/Utility/GDBRemoteSignals.cpp @@ -1,9 +1,8 @@ //===-- GDBRemoteSignals.cpp ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/GDBRemoteSignals.h b/source/Plugins/Process/Utility/GDBRemoteSignals.h index 79d8ec3fbbaf..a02dd0604e67 100644 --- a/source/Plugins/Process/Utility/GDBRemoteSignals.h +++ b/source/Plugins/Process/Utility/GDBRemoteSignals.h @@ -1,9 +1,8 @@ //===-- GDBRemoteSignals.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/HistoryThread.cpp b/source/Plugins/Process/Utility/HistoryThread.cpp index 4983dcdb5142..3cb583172623 100644 --- a/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/source/Plugins/Process/Utility/HistoryThread.cpp @@ -1,15 +1,15 @@ //===-- HistoryThread.cpp ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// #include "lldb/lldb-private.h" #include "Plugins/Process/Utility/HistoryThread.h" + #include "Plugins/Process/Utility/HistoryUnwind.h" #include "Plugins/Process/Utility/RegisterContextHistory.h" @@ -17,20 +17,20 @@ #include "lldb/Target/StackFrameList.h" #include "lldb/Utility/Log.h" +#include <memory> + using namespace lldb; using namespace lldb_private; // Constructor HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid, - std::vector<lldb::addr_t> pcs, uint32_t stop_id, - bool stop_id_is_valid) + std::vector<lldb::addr_t> pcs) : Thread(process, tid, true), m_framelist_mutex(), m_framelist(), - m_pcs(pcs), m_stop_id(stop_id), m_stop_id_is_valid(stop_id_is_valid), - m_extended_unwind_token(LLDB_INVALID_ADDRESS), m_queue_name(), + m_pcs(pcs), m_extended_unwind_token(LLDB_INVALID_ADDRESS), m_queue_name(), m_thread_name(), m_originating_unique_thread_id(tid), m_queue_id(LLDB_INVALID_QUEUE_ID) { - m_unwinder_ap.reset(new HistoryUnwind(*this, pcs, stop_id_is_valid)); + m_unwinder_up.reset(new HistoryUnwind(*this, pcs)); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); if (log) log->Printf("%p HistoryThread::HistoryThread", static_cast<void *>(this)); @@ -49,23 +49,24 @@ HistoryThread::~HistoryThread() { lldb::RegisterContextSP HistoryThread::GetRegisterContext() { RegisterContextSP rctx; if (m_pcs.size() > 0) { - rctx.reset(new RegisterContextHistory( - *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0])); + rctx = std::make_shared<RegisterContextHistory>( + *this, 0, GetProcess()->GetAddressByteSize(), m_pcs[0]); } return rctx; } lldb::RegisterContextSP HistoryThread::CreateRegisterContextForFrame(StackFrame *frame) { - return m_unwinder_ap->CreateRegisterContextForFrame(frame); + return m_unwinder_up->CreateRegisterContextForFrame(frame); } lldb::StackFrameListSP HistoryThread::GetStackFrameList() { // FIXME do not throw away the lock after we acquire it.. std::unique_lock<std::mutex> lock(m_framelist_mutex); lock.unlock(); - if (m_framelist.get() == NULL) { - m_framelist.reset(new StackFrameList(*this, StackFrameListSP(), true)); + if (m_framelist.get() == nullptr) { + m_framelist = + std::make_shared<StackFrameList>(*this, StackFrameListSP(), true); } return m_framelist; diff --git a/source/Plugins/Process/Utility/HistoryThread.h b/source/Plugins/Process/Utility/HistoryThread.h index dc24922e7c17..1e2658640172 100644 --- a/source/Plugins/Process/Utility/HistoryThread.h +++ b/source/Plugins/Process/Utility/HistoryThread.h @@ -1,9 +1,8 @@ //===-- HistoryThread.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -23,22 +22,18 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class HistoryThread HistoryThread.h "HistoryThread.h" +/// \class HistoryThread HistoryThread.h "HistoryThread.h" /// A thread object representing a backtrace from a previous point in the /// process execution /// /// This subclass of Thread is used to provide a backtrace from earlier in -/// process execution. It is given a backtrace list of pc addresses and -/// optionally a stop_id of when those pc addresses were collected, and it +/// process execution. It is given a backtrace list of pc addresses and it /// will create stack frames for them. -//---------------------------------------------------------------------- class HistoryThread : public lldb_private::Thread { public: HistoryThread(lldb_private::Process &process, lldb::tid_t tid, - std::vector<lldb::addr_t> pcs, uint32_t stop_id, - bool stop_id_is_valid); + std::vector<lldb::addr_t> pcs); ~HistoryThread() override; @@ -83,8 +78,6 @@ protected: mutable std::mutex m_framelist_mutex; lldb::StackFrameListSP m_framelist; std::vector<lldb::addr_t> m_pcs; - uint32_t m_stop_id; - bool m_stop_id_is_valid; uint64_t m_extended_unwind_token; std::string m_queue_name; diff --git a/source/Plugins/Process/Utility/HistoryUnwind.cpp b/source/Plugins/Process/Utility/HistoryUnwind.cpp index 4f0ecba613bf..7d473bff8200 100644 --- a/source/Plugins/Process/Utility/HistoryUnwind.cpp +++ b/source/Plugins/Process/Utility/HistoryUnwind.cpp @@ -1,9 +1,8 @@ //===-- HistoryUnwind.cpp ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -17,14 +16,15 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include <memory> + using namespace lldb; using namespace lldb_private; // Constructor -HistoryUnwind::HistoryUnwind(Thread &thread, std::vector<lldb::addr_t> pcs, - bool stop_id_is_valid) - : Unwind(thread), m_pcs(pcs), m_stop_id_is_valid(stop_id_is_valid) {} +HistoryUnwind::HistoryUnwind(Thread &thread, std::vector<lldb::addr_t> pcs) + : Unwind(thread), m_pcs(pcs) {} // Destructor @@ -33,7 +33,6 @@ HistoryUnwind::~HistoryUnwind() {} void HistoryUnwind::DoClear() { std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex); m_pcs.clear(); - m_stop_id_is_valid = false; } lldb::RegisterContextSP @@ -43,9 +42,9 @@ HistoryUnwind::DoCreateRegisterContextForFrame(StackFrame *frame) { addr_t pc = frame->GetFrameCodeAddress().GetLoadAddress( &frame->GetThread()->GetProcess()->GetTarget()); if (pc != LLDB_INVALID_ADDRESS) { - rctx.reset(new RegisterContextHistory( + rctx = std::make_shared<RegisterContextHistory>( *frame->GetThread().get(), frame->GetConcreteFrameIndex(), - frame->GetThread()->GetProcess()->GetAddressByteSize(), pc)); + frame->GetThread()->GetProcess()->GetAddressByteSize(), pc); } } return rctx; diff --git a/source/Plugins/Process/Utility/HistoryUnwind.h b/source/Plugins/Process/Utility/HistoryUnwind.h index 2cbfb680ef49..6c4522e6b35b 100644 --- a/source/Plugins/Process/Utility/HistoryUnwind.h +++ b/source/Plugins/Process/Utility/HistoryUnwind.h @@ -1,9 +1,8 @@ //===-- HistoryUnwind.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -19,8 +18,7 @@ namespace lldb_private { class HistoryUnwind : public lldb_private::Unwind { public: - HistoryUnwind(Thread &thread, std::vector<lldb::addr_t> pcs, - bool stop_id_is_valid); + HistoryUnwind(Thread &thread, std::vector<lldb::addr_t> pcs); ~HistoryUnwind() override; @@ -36,7 +34,6 @@ protected: private: std::vector<lldb::addr_t> m_pcs; - bool m_stop_id_is_valid; }; } // namespace lldb_private diff --git a/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp index 5c51a035ec66..9beaf2fc7ac8 100644 --- a/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp +++ b/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp @@ -1,9 +1,8 @@ //===-- InferiorCallPOSIX.cpp -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -39,7 +38,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr, unsigned flags, addr_t fd, addr_t offset) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL) + if (thread == nullptr) return false; const bool append = true; @@ -61,7 +60,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr, options.SetIgnoreBreakpoints(true); options.SetTryAllThreads(true); options.SetDebug(false); - options.SetTimeout(std::chrono::milliseconds(500)); + options.SetTimeout(process->GetUtilityExpressionTimeout()); options.SetTrapExceptions(false); addr_t prot_arg; @@ -127,7 +126,7 @@ bool lldb_private::InferiorCallMunmap(Process *process, addr_t addr, addr_t length) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL) + if (thread == nullptr) return false; const bool append = true; @@ -149,7 +148,7 @@ bool lldb_private::InferiorCallMunmap(Process *process, addr_t addr, options.SetIgnoreBreakpoints(true); options.SetTryAllThreads(true); options.SetDebug(false); - options.SetTimeout(std::chrono::milliseconds(500)); + options.SetTimeout(process->GetUtilityExpressionTimeout()); options.SetTrapExceptions(false); AddressRange munmap_range; @@ -189,7 +188,7 @@ bool lldb_private::InferiorCall(Process *process, const Address *address, addr_t &returned_func, bool trap_exceptions) { Thread *thread = process->GetThreadList().GetExpressionExecutionThread().get(); - if (thread == NULL || address == NULL) + if (thread == nullptr || address == nullptr) return false; EvaluateExpressionOptions options; @@ -198,7 +197,7 @@ bool lldb_private::InferiorCall(Process *process, const Address *address, options.SetIgnoreBreakpoints(true); options.SetTryAllThreads(true); options.SetDebug(false); - options.SetTimeout(std::chrono::milliseconds(500)); + options.SetTimeout(process->GetUtilityExpressionTimeout()); options.SetTrapExceptions(trap_exceptions); ClangASTContext *clang_ast_context = diff --git a/source/Plugins/Process/Utility/InferiorCallPOSIX.h b/source/Plugins/Process/Utility/InferiorCallPOSIX.h index 07bde5bf09b3..04316801b351 100644 --- a/source/Plugins/Process/Utility/InferiorCallPOSIX.h +++ b/source/Plugins/Process/Utility/InferiorCallPOSIX.h @@ -1,9 +1,8 @@ //===-- InferiorCallPOSIX.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/InstructionUtils.h b/source/Plugins/Process/Utility/InstructionUtils.h index 186d525ce499..f74933e691ee 100644 --- a/source/Plugins/Process/Utility/InstructionUtils.h +++ b/source/Plugins/Process/Utility/InstructionUtils.h @@ -1,9 +1,8 @@ //===-- InstructionUtils.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/LinuxProcMaps.cpp b/source/Plugins/Process/Utility/LinuxProcMaps.cpp index d45bf6dcd84f..1ba432aa542b 100644 --- a/source/Plugins/Process/Utility/LinuxProcMaps.cpp +++ b/source/Plugins/Process/Utility/LinuxProcMaps.cpp @@ -1,9 +1,8 @@ //===-- LinuxProcMaps.cpp ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/LinuxProcMaps.h b/source/Plugins/Process/Utility/LinuxProcMaps.h index e6eabb28fc82..e1f0e48ac5c9 100644 --- a/source/Plugins/Process/Utility/LinuxProcMaps.h +++ b/source/Plugins/Process/Utility/LinuxProcMaps.h @@ -1,9 +1,8 @@ //===-- LinuxProcMaps.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/LinuxSignals.cpp b/source/Plugins/Process/Utility/LinuxSignals.cpp index 6f1f67ac3570..bef47cd26307 100644 --- a/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -1,9 +1,8 @@ //===-- LinuxSignals.cpp ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/LinuxSignals.h b/source/Plugins/Process/Utility/LinuxSignals.h index f93a9d2e36d1..7ad8cfcbef68 100644 --- a/source/Plugins/Process/Utility/LinuxSignals.h +++ b/source/Plugins/Process/Utility/LinuxSignals.h @@ -1,9 +1,8 @@ //===-- LinuxSignals.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/MipsLinuxSignals.cpp b/source/Plugins/Process/Utility/MipsLinuxSignals.cpp index b6f3b34893bf..d8e5426ab5a5 100644 --- a/source/Plugins/Process/Utility/MipsLinuxSignals.cpp +++ b/source/Plugins/Process/Utility/MipsLinuxSignals.cpp @@ -1,10 +1,9 @@ //===-- MipsLinuxSignals.cpp ----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/MipsLinuxSignals.h b/source/Plugins/Process/Utility/MipsLinuxSignals.h index 2796f6b8e4d7..b5e3ed86f568 100644 --- a/source/Plugins/Process/Utility/MipsLinuxSignals.h +++ b/source/Plugins/Process/Utility/MipsLinuxSignals.h @@ -1,10 +1,9 @@ //===-- MipsLinuxSignals.h ------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp index 3a9d497711c0..be61cfdd7374 100644 --- a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp +++ b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp @@ -1,9 +1,8 @@ //===-- NativeRegisterContextRegisterInfo.cpp -------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h index 8f2e4409105f..b285c477cd96 100644 --- a/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h +++ b/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h @@ -1,9 +1,8 @@ //===-- NativeRegisterContextRegisterInfo.h ---------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/NetBSDSignals.cpp b/source/Plugins/Process/Utility/NetBSDSignals.cpp index a4baab9ac85f..29967deb7e9b 100644 --- a/source/Plugins/Process/Utility/NetBSDSignals.cpp +++ b/source/Plugins/Process/Utility/NetBSDSignals.cpp @@ -1,9 +1,8 @@ //===-- NetBSDSignals.cpp --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/NetBSDSignals.h b/source/Plugins/Process/Utility/NetBSDSignals.h index 7bb57fa0c0d6..bf7399a89060 100644 --- a/source/Plugins/Process/Utility/NetBSDSignals.h +++ b/source/Plugins/Process/Utility/NetBSDSignals.h @@ -1,9 +1,8 @@ //===-- NetBSDSignals.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDarwinConstants.h b/source/Plugins/Process/Utility/RegisterContextDarwinConstants.h index ff57464be2de..ef40162984f1 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwinConstants.h +++ b/source/Plugins/Process/Utility/RegisterContextDarwinConstants.h @@ -1,9 +1,8 @@ //===-- RegisterContextDarwinConstants.h ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp index 9ad896abd0b4..e804a4d251f7 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextDarwin_arm.cpp ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -20,6 +19,8 @@ #include "Plugins/Process/Utility/InstructionUtils.h" +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -197,7 +198,7 @@ static RegisterInfo g_register_infos[] = { // =============== =============== ========================= // ===================== ============= {"r0", - NULL, + nullptr, 4, GPR_OFFSET(0), eEncodingUint, @@ -208,7 +209,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r1", - NULL, + nullptr, 4, GPR_OFFSET(1), eEncodingUint, @@ -219,7 +220,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r2", - NULL, + nullptr, 4, GPR_OFFSET(2), eEncodingUint, @@ -230,7 +231,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r3", - NULL, + nullptr, 4, GPR_OFFSET(3), eEncodingUint, @@ -241,7 +242,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r4", - NULL, + nullptr, 4, GPR_OFFSET(4), eEncodingUint, @@ -252,7 +253,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r5", - NULL, + nullptr, 4, GPR_OFFSET(5), eEncodingUint, @@ -263,7 +264,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r6", - NULL, + nullptr, 4, GPR_OFFSET(6), eEncodingUint, @@ -274,7 +275,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r7", - NULL, + nullptr, 4, GPR_OFFSET(7), eEncodingUint, @@ -286,7 +287,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r8", - NULL, + nullptr, 4, GPR_OFFSET(8), eEncodingUint, @@ -297,7 +298,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r9", - NULL, + nullptr, 4, GPR_OFFSET(9), eEncodingUint, @@ -308,7 +309,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r10", - NULL, + nullptr, 4, GPR_OFFSET(10), eEncodingUint, @@ -320,7 +321,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r11", - NULL, + nullptr, 4, GPR_OFFSET(11), eEncodingUint, @@ -332,7 +333,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"r12", - NULL, + nullptr, 4, GPR_OFFSET(12), eEncodingUint, @@ -393,7 +394,7 @@ static RegisterInfo g_register_infos[] = { 0}, {"s0", - NULL, + nullptr, 4, FPU_OFFSET(0), eEncodingIEEE754, @@ -405,7 +406,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s1", - NULL, + nullptr, 4, FPU_OFFSET(1), eEncodingIEEE754, @@ -417,7 +418,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s2", - NULL, + nullptr, 4, FPU_OFFSET(2), eEncodingIEEE754, @@ -429,7 +430,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s3", - NULL, + nullptr, 4, FPU_OFFSET(3), eEncodingIEEE754, @@ -441,7 +442,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s4", - NULL, + nullptr, 4, FPU_OFFSET(4), eEncodingIEEE754, @@ -453,7 +454,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s5", - NULL, + nullptr, 4, FPU_OFFSET(5), eEncodingIEEE754, @@ -465,7 +466,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s6", - NULL, + nullptr, 4, FPU_OFFSET(6), eEncodingIEEE754, @@ -477,7 +478,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s7", - NULL, + nullptr, 4, FPU_OFFSET(7), eEncodingIEEE754, @@ -489,7 +490,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s8", - NULL, + nullptr, 4, FPU_OFFSET(8), eEncodingIEEE754, @@ -501,7 +502,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s9", - NULL, + nullptr, 4, FPU_OFFSET(9), eEncodingIEEE754, @@ -513,7 +514,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s10", - NULL, + nullptr, 4, FPU_OFFSET(10), eEncodingIEEE754, @@ -525,7 +526,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s11", - NULL, + nullptr, 4, FPU_OFFSET(11), eEncodingIEEE754, @@ -537,7 +538,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s12", - NULL, + nullptr, 4, FPU_OFFSET(12), eEncodingIEEE754, @@ -549,7 +550,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s13", - NULL, + nullptr, 4, FPU_OFFSET(13), eEncodingIEEE754, @@ -561,7 +562,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s14", - NULL, + nullptr, 4, FPU_OFFSET(14), eEncodingIEEE754, @@ -573,7 +574,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s15", - NULL, + nullptr, 4, FPU_OFFSET(15), eEncodingIEEE754, @@ -585,7 +586,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s16", - NULL, + nullptr, 4, FPU_OFFSET(16), eEncodingIEEE754, @@ -597,7 +598,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s17", - NULL, + nullptr, 4, FPU_OFFSET(17), eEncodingIEEE754, @@ -609,7 +610,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s18", - NULL, + nullptr, 4, FPU_OFFSET(18), eEncodingIEEE754, @@ -621,7 +622,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s19", - NULL, + nullptr, 4, FPU_OFFSET(19), eEncodingIEEE754, @@ -633,7 +634,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s20", - NULL, + nullptr, 4, FPU_OFFSET(20), eEncodingIEEE754, @@ -645,7 +646,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s21", - NULL, + nullptr, 4, FPU_OFFSET(21), eEncodingIEEE754, @@ -657,7 +658,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s22", - NULL, + nullptr, 4, FPU_OFFSET(22), eEncodingIEEE754, @@ -669,7 +670,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s23", - NULL, + nullptr, 4, FPU_OFFSET(23), eEncodingIEEE754, @@ -681,7 +682,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s24", - NULL, + nullptr, 4, FPU_OFFSET(24), eEncodingIEEE754, @@ -693,7 +694,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s25", - NULL, + nullptr, 4, FPU_OFFSET(25), eEncodingIEEE754, @@ -705,7 +706,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s26", - NULL, + nullptr, 4, FPU_OFFSET(26), eEncodingIEEE754, @@ -717,7 +718,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s27", - NULL, + nullptr, 4, FPU_OFFSET(27), eEncodingIEEE754, @@ -729,7 +730,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s28", - NULL, + nullptr, 4, FPU_OFFSET(28), eEncodingIEEE754, @@ -741,7 +742,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s29", - NULL, + nullptr, 4, FPU_OFFSET(29), eEncodingIEEE754, @@ -753,7 +754,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s30", - NULL, + nullptr, 4, FPU_OFFSET(30), eEncodingIEEE754, @@ -765,7 +766,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"s31", - NULL, + nullptr, 4, FPU_OFFSET(31), eEncodingIEEE754, @@ -777,7 +778,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"fpscr", - NULL, + nullptr, 4, FPU_OFFSET(32), eEncodingUint, @@ -790,7 +791,7 @@ static RegisterInfo g_register_infos[] = { 0}, {"exception", - NULL, + nullptr, 4, EXC_OFFSET(0), eEncodingUint, @@ -802,7 +803,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"fsr", - NULL, + nullptr, 4, EXC_OFFSET(1), eEncodingUint, @@ -814,7 +815,7 @@ static RegisterInfo g_register_infos[] = { nullptr, 0}, {"far", - NULL, + nullptr, 4, EXC_OFFSET(2), eEncodingUint, @@ -943,7 +944,7 @@ RegisterContextDarwin_arm::GetRegisterInfoAtIndex(size_t reg) { assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_arm::GetRegisterInfosCount() { @@ -959,11 +960,9 @@ const size_t k_num_gpr_registers = llvm::array_lengthof(g_gpr_regnums); const size_t k_num_fpu_registers = llvm::array_lengthof(g_fpu_regnums); const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); -//---------------------------------------------------------------------- // Register set definitions. The first definitions at register set index of // zero is for all registers, followed by other registers sets. The register // information for the all register set need not be filled in. -//---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums, @@ -980,12 +979,10 @@ size_t RegisterContextDarwin_arm::GetRegisterSetCount() { const RegisterSet *RegisterContextDarwin_arm::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } -//---------------------------------------------------------------------- // Register information definitions for 32 bit i386. -//---------------------------------------------------------------------- int RegisterContextDarwin_arm::GetSetForNativeRegNum(int reg) { if (reg < fpu_s0) return GPRRegSet; @@ -1297,7 +1294,7 @@ bool RegisterContextDarwin_arm::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_arm::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); if (data_sp && ReadGPR(false) == KERN_SUCCESS && ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) { uint8_t *dst = data_sp->GetBytes(); diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h index b46946d608bc..d7c1809a3222 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm.h @@ -1,9 +1,8 @@ //===-- RegisterContextDarwin_arm.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp index b478645e035d..85d518a487bf 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -1,10 +1,9 @@ //===-- RegisterContextDarwin_arm64.cpp ---------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ #include "Plugins/Process/Utility/InstructionUtils.h" +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -66,9 +67,7 @@ using namespace lldb_private; sizeof(RegisterContextDarwin_arm64::FPU) + \ sizeof(RegisterContextDarwin_arm64::EXC)) -//----------------------------------------------------------------------------- // Include RegisterInfos_arm64 to declare our g_register_infos_arm64 structure. -//----------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_ARM64_STRUCT #include "RegisterInfos_arm64.h" #undef DECLARE_REGISTER_INFOS_ARM64_STRUCT @@ -123,7 +122,7 @@ RegisterContextDarwin_arm64::GetRegisterInfoAtIndex(size_t reg) { assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos_arm64_le[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_arm64::GetRegisterInfosCount() { @@ -139,11 +138,9 @@ const size_t k_num_gpr_registers = llvm::array_lengthof(g_gpr_regnums); const size_t k_num_fpu_registers = llvm::array_lengthof(g_fpu_regnums); const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); -//---------------------------------------------------------------------- // Register set definitions. The first definitions at register set index of // zero is for all registers, followed by other registers sets. The register // information for the all register set need not be filled in. -//---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums, @@ -160,12 +157,10 @@ size_t RegisterContextDarwin_arm64::GetRegisterSetCount() { const RegisterSet *RegisterContextDarwin_arm64::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } -//---------------------------------------------------------------------- // Register information definitions for arm64 -//---------------------------------------------------------------------- int RegisterContextDarwin_arm64::GetSetForNativeRegNum(int reg) { if (reg < fpu_v0) return GPRRegSet; @@ -428,7 +423,7 @@ bool RegisterContextDarwin_arm64::ReadRegister(const RegisterInfo *reg_info, case fpu_v29: case fpu_v30: case fpu_v31: - value.SetBytes(fpu.v[reg].bytes.buffer, reg_info->byte_size, + value.SetBytes(fpu.v[reg - fpu_v0].bytes.buffer, reg_info->byte_size, endian::InlHostByteOrder()); break; @@ -620,7 +615,8 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info, case fpu_v29: case fpu_v30: case fpu_v31: - ::memcpy(fpu.v[reg].bytes.buffer, value.GetBytes(), value.GetByteSize()); + ::memcpy(fpu.v[reg - fpu_v0].bytes.buffer, value.GetBytes(), + value.GetByteSize()); break; case fpu_fpsr: @@ -649,9 +645,9 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_arm64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); - if (data_sp && ReadGPR(false) == KERN_SUCCESS && - ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) { + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); + if (ReadGPR(false) == KERN_SUCCESS && ReadFPU(false) == KERN_SUCCESS && + ReadEXC(false) == KERN_SUCCESS) { uint8_t *dst = data_sp->GetBytes(); ::memcpy(dst, &gpr, sizeof(gpr)); dst += sizeof(gpr); diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h index 9e826d85af08..2f691c807d50 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h @@ -1,10 +1,9 @@ //===-- RegisterContextDarwin_arm64.h -----------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp index c9e4b37a17f3..820d280c37f7 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp @@ -1,14 +1,11 @@ //===-- RegisterContextDarwin_i386.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// -#include <stddef.h> - #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" @@ -18,6 +15,10 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" +#include <stddef.h> + +#include <memory> + // Support building against older versions of LLVM, this macro was added // recently. #ifndef LLVM_EXTENSION @@ -175,42 +176,42 @@ static RegisterInfo g_register_infos[] = { // =============================== ======================= // =================== ========================= ================== // ================= - {DEFINE_GPR(eax, NULL), + {DEFINE_GPR(eax, nullptr), {ehframe_eax, dwarf_eax, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_eax}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ebx, NULL), + {DEFINE_GPR(ebx, nullptr), {ehframe_ebx, dwarf_ebx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ebx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ecx, NULL), + {DEFINE_GPR(ecx, nullptr), {ehframe_ecx, dwarf_ecx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ecx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(edx, NULL), + {DEFINE_GPR(edx, nullptr), {ehframe_edx, dwarf_edx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_edx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(edi, NULL), + {DEFINE_GPR(edi, nullptr), {ehframe_edi, dwarf_edi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_edi}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(esi, NULL), + {DEFINE_GPR(esi, nullptr), {ehframe_esi, dwarf_esi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_esi}, nullptr, @@ -231,7 +232,7 @@ static RegisterInfo g_register_infos[] = { nullptr, nullptr, 0}, - {DEFINE_GPR(ss, NULL), + {DEFINE_GPR(ss, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ss}, nullptr, @@ -252,35 +253,35 @@ static RegisterInfo g_register_infos[] = { nullptr, nullptr, 0}, - {DEFINE_GPR(cs, NULL), + {DEFINE_GPR(cs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_cs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(ds, NULL), + {DEFINE_GPR(ds, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_ds}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(es, NULL), + {DEFINE_GPR(es, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_es}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(fs, NULL), + {DEFINE_GPR(fs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_fs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(gs, NULL), + {DEFINE_GPR(gs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_gs}, nullptr, @@ -426,7 +427,7 @@ RegisterContextDarwin_i386::GetRegisterInfoAtIndex(size_t reg) { assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_i386::GetRegisterInfosCount() { @@ -459,11 +460,9 @@ const size_t k_num_gpr_registers = llvm::array_lengthof(g_gpr_regnums); const size_t k_num_fpu_registers = llvm::array_lengthof(g_fpu_regnums); const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); -//---------------------------------------------------------------------- // Register set definitions. The first definitions at register set index of // zero is for all registers, followed by other registers sets. The register // information for the all register set need not be filled in. -//---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums, @@ -480,12 +479,10 @@ size_t RegisterContextDarwin_i386::GetRegisterSetCount() { const RegisterSet *RegisterContextDarwin_i386::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } -//---------------------------------------------------------------------- // Register information definitions for 32 bit i386. -//---------------------------------------------------------------------- int RegisterContextDarwin_i386::GetSetForNativeRegNum(int reg_num) { if (reg_num < fpu_fcw) return GPRRegSet; @@ -832,9 +829,8 @@ bool RegisterContextDarwin_i386::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_i386::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); - if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 && - ReadEXC(false) == 0) { + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); + if (ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) { uint8_t *dst = data_sp->GetBytes(); ::memcpy(dst, &gpr, sizeof(gpr)); dst += sizeof(gpr); diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h index ad6a1e48fc34..e52f0fe63250 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h @@ -1,9 +1,8 @@ //===-- RegisterContextDarwin_i386.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp index 95460308857a..62e512adc9f7 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextDarwin_x86_64.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -11,6 +10,8 @@ #include <stdarg.h> #include <stddef.h> +#include <memory> + #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Endian.h" @@ -194,42 +195,42 @@ static RegisterInfo g_register_infos[] = { // =============================== ====================== // =================== ========================== ==================== // =================== - {DEFINE_GPR(rax, NULL), + {DEFINE_GPR(rax, nullptr), {ehframe_dwarf_gpr_rax, ehframe_dwarf_gpr_rax, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rax}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rbx, NULL), + {DEFINE_GPR(rbx, nullptr), {ehframe_dwarf_gpr_rbx, ehframe_dwarf_gpr_rbx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rbx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rcx, NULL), + {DEFINE_GPR(rcx, nullptr), {ehframe_dwarf_gpr_rcx, ehframe_dwarf_gpr_rcx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rcx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rdx, NULL), + {DEFINE_GPR(rdx, nullptr), {ehframe_dwarf_gpr_rdx, ehframe_dwarf_gpr_rdx, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rdx}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rdi, NULL), + {DEFINE_GPR(rdi, nullptr), {ehframe_dwarf_gpr_rdi, ehframe_dwarf_gpr_rdi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rdi}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(rsi, NULL), + {DEFINE_GPR(rsi, nullptr), {ehframe_dwarf_gpr_rsi, ehframe_dwarf_gpr_rsi, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_rsi}, nullptr, @@ -250,56 +251,56 @@ static RegisterInfo g_register_infos[] = { nullptr, nullptr, 0}, - {DEFINE_GPR(r8, NULL), + {DEFINE_GPR(r8, nullptr), {ehframe_dwarf_gpr_r8, ehframe_dwarf_gpr_r8, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r8}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r9, NULL), + {DEFINE_GPR(r9, nullptr), {ehframe_dwarf_gpr_r9, ehframe_dwarf_gpr_r9, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r9}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r10, NULL), + {DEFINE_GPR(r10, nullptr), {ehframe_dwarf_gpr_r10, ehframe_dwarf_gpr_r10, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r10}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r11, NULL), + {DEFINE_GPR(r11, nullptr), {ehframe_dwarf_gpr_r11, ehframe_dwarf_gpr_r11, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r11}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r12, NULL), + {DEFINE_GPR(r12, nullptr), {ehframe_dwarf_gpr_r12, ehframe_dwarf_gpr_r12, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r12}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r13, NULL), + {DEFINE_GPR(r13, nullptr), {ehframe_dwarf_gpr_r13, ehframe_dwarf_gpr_r13, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r13}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r14, NULL), + {DEFINE_GPR(r14, nullptr), {ehframe_dwarf_gpr_r14, ehframe_dwarf_gpr_r14, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r14}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(r15, NULL), + {DEFINE_GPR(r15, nullptr), {ehframe_dwarf_gpr_r15, ehframe_dwarf_gpr_r15, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_r15}, nullptr, @@ -320,21 +321,21 @@ static RegisterInfo g_register_infos[] = { nullptr, nullptr, 0}, - {DEFINE_GPR(cs, NULL), + {DEFINE_GPR(cs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_cs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(fs, NULL), + {DEFINE_GPR(fs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_fs}, nullptr, nullptr, nullptr, 0}, - {DEFINE_GPR(gs, NULL), + {DEFINE_GPR(gs, nullptr), {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_gs}, nullptr, @@ -488,7 +489,7 @@ RegisterContextDarwin_x86_64::GetRegisterInfoAtIndex(size_t reg) { assert(k_num_register_infos == k_num_registers); if (reg < k_num_registers) return &g_register_infos[reg]; - return NULL; + return nullptr; } size_t RegisterContextDarwin_x86_64::GetRegisterInfosCount() { @@ -520,11 +521,9 @@ const size_t k_num_gpr_registers = llvm::array_lengthof(g_gpr_regnums); const size_t k_num_fpu_registers = llvm::array_lengthof(g_fpu_regnums); const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); -//---------------------------------------------------------------------- // Register set definitions. The first definitions at register set index of // zero is for all registers, followed by other registers sets. The register // information for the all register set need not be filled in. -//---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums, @@ -542,7 +541,7 @@ const RegisterSet * RegisterContextDarwin_x86_64::GetRegisterSet(size_t reg_set) { if (reg_set < k_num_regsets) return &g_reg_sets[reg_set]; - return NULL; + return nullptr; } int RegisterContextDarwin_x86_64::GetSetForNativeRegNum(int reg_num) { @@ -910,9 +909,8 @@ bool RegisterContextDarwin_x86_64::WriteRegister(const RegisterInfo *reg_info, bool RegisterContextDarwin_x86_64::ReadAllRegisterValues( lldb::DataBufferSP &data_sp) { - data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0)); - if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 && - ReadEXC(false) == 0) { + data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0); + if (ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) { uint8_t *dst = data_sp->GetBytes(); ::memcpy(dst, &gpr, sizeof(gpr)); dst += sizeof(gpr); diff --git a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h index 6d94bf75aad4..1a65a4f28b33 100644 --- a/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterContextDarwin_x86_64.h --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextDummy.cpp b/source/Plugins/Process/Utility/RegisterContextDummy.cpp index c51c30f45a5d..6832b6095931 100644 --- a/source/Plugins/Process/Utility/RegisterContextDummy.cpp +++ b/source/Plugins/Process/Utility/RegisterContextDummy.cpp @@ -1,10 +1,9 @@ //===-- RegisterContextDummy.cpp ---------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -50,8 +49,8 @@ RegisterContextDummy::RegisterContextDummy(Thread &thread, m_pc_reg_info.byte_size = address_byte_size; m_pc_reg_info.encoding = eEncodingUint; m_pc_reg_info.format = eFormatPointer; - m_pc_reg_info.invalidate_regs = NULL; - m_pc_reg_info.value_regs = NULL; + m_pc_reg_info.invalidate_regs = nullptr; + m_pc_reg_info.value_regs = nullptr; m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; @@ -72,7 +71,7 @@ size_t RegisterContextDummy::GetRegisterCount() { return 1; } const lldb_private::RegisterInfo * RegisterContextDummy::GetRegisterInfoAtIndex(size_t reg) { if (reg) - return NULL; + return nullptr; return &m_pc_reg_info; } @@ -81,7 +80,7 @@ size_t RegisterContextDummy::GetRegisterSetCount() { return 1; } const lldb_private::RegisterSet * RegisterContextDummy::GetRegisterSet(size_t reg_set) { if (reg_set) - return NULL; + return nullptr; return &m_reg_set0; } diff --git a/source/Plugins/Process/Utility/RegisterContextDummy.h b/source/Plugins/Process/Utility/RegisterContextDummy.h index d5608616c896..bdaa2217d207 100644 --- a/source/Plugins/Process/Utility/RegisterContextDummy.h +++ b/source/Plugins/Process/Utility/RegisterContextDummy.h @@ -1,10 +1,9 @@ //===-- RegisterContextDummy.h ----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -52,9 +51,7 @@ public: uint32_t num) override; private: - //------------------------------------------------------------------ // For RegisterContextLLDB only - //------------------------------------------------------------------ lldb_private::RegisterSet m_reg_set0; // register set 0 (PC only) lldb_private::RegisterInfo m_pc_reg_info; diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp b/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp index 4ccfa2a16fef..b90b38108267 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_i386.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -54,9 +53,7 @@ struct UserArea { #define DR_SIZE sizeof(uint32_t) #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(dbreg, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_I386_STRUCT #include "RegisterInfos_i386.h" #undef DECLARE_REGISTER_INFOS_I386_STRUCT @@ -73,7 +70,7 @@ const RegisterInfo *RegisterContextFreeBSD_i386::GetRegisterInfo() const { return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h b/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h index 35a79c14abfc..7aadf3a0a4c9 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_i386.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp b/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp index 55a72b2a31b4..4331ef5ad14e 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_mips64.cpp ----------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -80,10 +79,8 @@ typedef struct _GPR { uint64_t dummy; } GPR_freebsd_mips; -//--------------------------------------------------------------------------- // Include RegisterInfos_mips64 to declare our g_register_infos_mips64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_MIPS64_STRUCT #include "RegisterInfos_mips64.h" #undef DECLARE_REGISTER_INFOS_MIPS64_STRUCT diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h b/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h index 5e5de71ad72e..96f02b4440c5 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_mips64.h -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp b/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp index efa4cc6d8182..4f869eb3b177 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_powerpc.cpp ----------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -169,10 +168,8 @@ typedef struct _VMX { uint32_t vscr; } VMX; -//--------------------------------------------------------------------------- // Include RegisterInfos_powerpc to declare our g_register_infos_powerpc // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_POWERPC_STRUCT #include "RegisterInfos_powerpc.h" #undef DECLARE_REGISTER_INFOS_POWERPC_STRUCT @@ -191,7 +188,7 @@ size_t RegisterContextFreeBSD_powerpc::GetGPRSize() const { const RegisterInfo *RegisterContextFreeBSD_powerpc::GetRegisterInfo() const { // assert (m_target_arch.GetCore() == ArchSpec::eCore_powerpc); llvm_unreachable("Abstract class!"); - return NULL; + return nullptr; } uint32_t RegisterContextFreeBSD_powerpc::GetRegisterCount() const { return 0; } diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h b/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h index b74d0ea75469..ba2751194d16 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h @@ -1,10 +1,9 @@ //===-- RegisterContextFreeBSD_powerpc.h -------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp index 4bbbd5c3d0a6..bcf3951ee077 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_x86_64.cpp ----------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -62,10 +61,8 @@ struct UserArea { #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(DBG, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_X86_64_STRUCT #include "RegisterInfos_x86_64.h" #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT @@ -89,10 +86,8 @@ GetRegisterInfo_i386(const lldb_private::ArchSpec &arch) { g_register_infos.insert(g_register_infos.end(), &base_info[0], &base_info[k_num_registers_i386]); -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to update the g_register_infos structure // with x86_64 offsets. -//--------------------------------------------------------------------------- #define UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS #include "RegisterInfos_x86_64.h" #undef UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS diff --git a/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h b/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h index dc30f1783b41..c379e1a5cd75 100644 --- a/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterContextFreeBSD_x86_64.h -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextHistory.cpp b/source/Plugins/Process/Utility/RegisterContextHistory.cpp index c9b77663a803..c19a2bfae668 100644 --- a/source/Plugins/Process/Utility/RegisterContextHistory.cpp +++ b/source/Plugins/Process/Utility/RegisterContextHistory.cpp @@ -1,10 +1,9 @@ //===-- RegisterContextHistory.cpp ---------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -51,8 +50,8 @@ RegisterContextHistory::RegisterContextHistory(Thread &thread, m_pc_reg_info.byte_size = address_byte_size; m_pc_reg_info.encoding = eEncodingUint; m_pc_reg_info.format = eFormatPointer; - m_pc_reg_info.invalidate_regs = NULL; - m_pc_reg_info.value_regs = NULL; + m_pc_reg_info.invalidate_regs = nullptr; + m_pc_reg_info.value_regs = nullptr; m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM; m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC; @@ -73,7 +72,7 @@ size_t RegisterContextHistory::GetRegisterCount() { return 1; } const lldb_private::RegisterInfo * RegisterContextHistory::GetRegisterInfoAtIndex(size_t reg) { if (reg) - return NULL; + return nullptr; return &m_pc_reg_info; } @@ -82,7 +81,7 @@ size_t RegisterContextHistory::GetRegisterSetCount() { return 1; } const lldb_private::RegisterSet * RegisterContextHistory::GetRegisterSet(size_t reg_set) { if (reg_set) - return NULL; + return nullptr; return &m_reg_set0; } diff --git a/source/Plugins/Process/Utility/RegisterContextHistory.h b/source/Plugins/Process/Utility/RegisterContextHistory.h index 01b3624f8c5b..952e4263d955 100644 --- a/source/Plugins/Process/Utility/RegisterContextHistory.h +++ b/source/Plugins/Process/Utility/RegisterContextHistory.h @@ -1,10 +1,9 @@ //===-- RegisterContextHistory.h ----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -52,9 +51,7 @@ public: uint32_t num) override; private: - //------------------------------------------------------------------ // For RegisterContextLLDB only - //------------------------------------------------------------------ lldb_private::RegisterSet m_reg_set0; // register set 0 (PC only) lldb_private::RegisterInfo m_pc_reg_info; diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 8c420a87e1b0..76646d8897d1 100644 --- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLLDB.cpp --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -35,6 +34,8 @@ #include "RegisterContextLLDB.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -112,7 +113,7 @@ void RegisterContextLLDB::InitializeZerothFrame() { ExecutionContext exe_ctx(m_thread.shared_from_this()); RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext(); - if (reg_ctx_sp.get() == NULL) { + if (reg_ctx_sp.get() == nullptr) { m_frame_type = eNotAValidFrame; UnwindLogMsg("frame does not have a register context"); return; @@ -238,14 +239,13 @@ void RegisterContextLLDB::InitializeZerothFrame() { if (m_sym_ctx_valid) { func_unwinders_sp = - pc_module_sp->GetObjectFile() - ->GetUnwindTable() - .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx); + pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress( + m_current_pc, m_sym_ctx); } if (func_unwinders_sp.get() != nullptr) call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite( - process->GetTarget(), m_current_offset_backed_up_one); + process->GetTarget(), m_thread); if (call_site_unwind_plan.get() != nullptr) { m_fallback_unwind_plan_sp = call_site_unwind_plan; @@ -370,7 +370,8 @@ void RegisterContextLLDB::InitializeNonZerothFrame() { if (abi) { m_fast_unwind_plan_sp.reset(); - m_full_unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + m_full_unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateDefaultUnwindPlan(*m_full_unwind_plan_sp); if (m_frame_type != eSkipFrame) // don't override eSkipFrame { @@ -663,16 +664,15 @@ UnwindPlanSP RegisterContextLLDB::GetFastUnwindPlanForFrame() { ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) + pc_module_sp->GetObjectFile() == nullptr) return unwind_plan_sp; if (IsFrameZero()) return unwind_plan_sp; FuncUnwindersSP func_unwinders_sp( - pc_module_sp->GetObjectFile() - ->GetUnwindTable() - .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx)); + pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress( + m_current_pc, m_sym_ctx)); if (!func_unwinders_sp) return unwind_plan_sp; @@ -715,10 +715,10 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { UnwindPlanSP arch_default_unwind_plan_sp; ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { - arch_default_unwind_plan_sp.reset( - new UnwindPlan(lldb::eRegisterKindGeneric)); + arch_default_unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateDefaultUnwindPlan(*arch_default_unwind_plan_sp); } else { UnwindLogMsg( @@ -743,7 +743,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // This is for jumping to memory regions without any information available. if ((!m_sym_ctx_valid || - (m_sym_ctx.function == NULL && m_sym_ctx.symbol == NULL)) && + (m_sym_ctx.function == nullptr && m_sym_ctx.symbol == nullptr)) && behaves_like_zeroth_frame && m_current_pc.IsValid()) { uint32_t permissions; addr_t current_pc_addr = @@ -753,7 +753,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { process->GetLoadAddressPermissions(current_pc_addr, permissions) && (permissions & ePermissionsExecutable) == 0)) { if (abi) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = + std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); abi->CreateFunctionEntryUnwindPlan(*unwind_plan_sp); m_frame_type = eNormalFrame; return unwind_plan_sp; @@ -764,7 +765,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // No Module for the current pc, try using the architecture default unwind. ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp || - pc_module_sp->GetObjectFile() == NULL) { + pc_module_sp->GetObjectFile() == nullptr) { m_frame_type = eNormalFrame; return arch_default_unwind_plan_sp; } @@ -772,9 +773,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { FuncUnwindersSP func_unwinders_sp; if (m_sym_ctx_valid) { func_unwinders_sp = - pc_module_sp->GetObjectFile() - ->GetUnwindTable() - .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx); + pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress( + m_current_pc, m_sym_ctx); } // No FuncUnwinders available for this pc (stripped function symbols, lldb @@ -792,9 +792,9 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // Even with -fomit-frame-pointer, we can try eh_frame to get back on // track. DWARFCallFrameInfo *eh_frame = - pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo(); + pc_module_sp->GetUnwindTable().GetEHFrameInfo(); if (eh_frame) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); if (eh_frame->GetUnwindPlan(m_current_pc, *unwind_plan_sp)) return unwind_plan_sp; else @@ -802,9 +802,9 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { } ArmUnwindInfo *arm_exidx = - pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo(); + pc_module_sp->GetUnwindTable().GetArmUnwindInfo(); if (arm_exidx) { - unwind_plan_sp.reset(new UnwindPlan(lldb::eRegisterKindGeneric)); + unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric); if (arm_exidx->GetUnwindPlan(exe_ctx.GetTargetRef(), m_current_pc, *unwind_plan_sp)) return unwind_plan_sp; @@ -822,8 +822,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // unwind out of sigtramp. if (m_frame_type == eTrapHandlerFrame && process) { m_fast_unwind_plan_sp.reset(); - unwind_plan_sp = func_unwinders_sp->GetEHFrameUnwindPlan( - process->GetTarget(), m_current_offset_backed_up_one); + unwind_plan_sp = + func_unwinders_sp->GetEHFrameUnwindPlan(process->GetTarget()); if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc) && unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolYes) { return unwind_plan_sp; @@ -844,8 +844,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // normally we would call GetUnwindPlanAtCallSite() -- because CallSite may // return an unwind plan sourced from either eh_frame (that's what we // intend) or compact unwind (this won't work) - unwind_plan_sp = func_unwinders_sp->GetEHFrameUnwindPlan( - process->GetTarget(), m_current_offset_backed_up_one); + unwind_plan_sp = + func_unwinders_sp->GetEHFrameUnwindPlan(process->GetTarget()); if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { UnwindLogMsgVerbose("frame uses %s for full UnwindPlan because the " "DynamicLoader suggested we prefer it", @@ -858,7 +858,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // the assembly language instructions if (behaves_like_zeroth_frame && process) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite( - process->GetTarget(), m_thread, m_current_offset_backed_up_one); + process->GetTarget(), m_thread); if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { if (unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolNo) { // We probably have an UnwindPlan created by inspecting assembly @@ -873,8 +873,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // location what helps in the most common cases when the instruction // emulation fails. UnwindPlanSP call_site_unwind_plan = - func_unwinders_sp->GetUnwindPlanAtCallSite( - process->GetTarget(), m_current_offset_backed_up_one); + func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget(), + m_thread); if (call_site_unwind_plan && call_site_unwind_plan.get() != unwind_plan_sp.get() && call_site_unwind_plan->GetSourceName() != @@ -884,21 +884,39 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { m_fallback_unwind_plan_sp = arch_default_unwind_plan_sp; } } - UnwindLogMsgVerbose("frame uses %s for full UnwindPlan", + UnwindLogMsgVerbose("frame uses %s for full UnwindPlan because this " + "is the non-call site unwind plan and this is a " + "zeroth frame", unwind_plan_sp->GetSourceName().GetCString()); return unwind_plan_sp; } + + // If we're on the first instruction of a function, and we have an + // architectural default UnwindPlan for the initial instruction of a + // function, use that. + if (m_current_offset == 0) { + unwind_plan_sp = + func_unwinders_sp->GetUnwindPlanArchitectureDefaultAtFunctionEntry( + m_thread); + if (unwind_plan_sp) { + UnwindLogMsgVerbose("frame uses %s for full UnwindPlan because we are at " + "the first instruction of a function", + unwind_plan_sp->GetSourceName().GetCString()); + return unwind_plan_sp; + } + } } // Typically this is unwind info from an eh_frame section intended for // exception handling; only valid at call sites if (process) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite( - process->GetTarget(), m_current_offset_backed_up_one); + process->GetTarget(), m_thread); } int valid_offset = -1; if (IsUnwindPlanValidForCurrentPC(unwind_plan_sp, valid_offset)) { - UnwindLogMsgVerbose("frame uses %s for full UnwindPlan", + UnwindLogMsgVerbose("frame uses %s for full UnwindPlan because this " + "is the call-site unwind plan", unwind_plan_sp->GetSourceName().GetCString()); return unwind_plan_sp; } @@ -908,7 +926,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // call-site assembly inspection UnwindPlan if possible. if (process) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite( - process->GetTarget(), m_thread, m_current_offset_backed_up_one); + process->GetTarget(), m_thread); } if (unwind_plan_sp && unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolNo) { @@ -923,8 +941,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { // code it is often written in a way that it valid at all location what // helps in the most common cases when the instruction emulation fails. UnwindPlanSP call_site_unwind_plan = - func_unwinders_sp->GetUnwindPlanAtCallSite( - process->GetTarget(), m_current_offset_backed_up_one); + func_unwinders_sp->GetUnwindPlanAtCallSite(process->GetTarget(), + m_thread); if (call_site_unwind_plan && call_site_unwind_plan.get() != unwind_plan_sp.get() && call_site_unwind_plan->GetSourceName() != @@ -936,30 +954,18 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { } if (IsUnwindPlanValidForCurrentPC(unwind_plan_sp, valid_offset)) { - UnwindLogMsgVerbose("frame uses %s for full UnwindPlan", + UnwindLogMsgVerbose("frame uses %s for full UnwindPlan because we " + "failed to find a call-site unwind plan that would work", unwind_plan_sp->GetSourceName().GetCString()); return unwind_plan_sp; } - // If we're on the first instruction of a function, and we have an - // architectural default UnwindPlan for the initial instruction of a - // function, use that. - if (m_current_offset_backed_up_one == 0) { - unwind_plan_sp = - func_unwinders_sp->GetUnwindPlanArchitectureDefaultAtFunctionEntry( - m_thread); - if (unwind_plan_sp) { - UnwindLogMsgVerbose("frame uses %s for full UnwindPlan", - unwind_plan_sp->GetSourceName().GetCString()); - return unwind_plan_sp; - } - } - // If nothing else, use the architectural default UnwindPlan and hope that // does the job. if (arch_default_unwind_plan_sp) UnwindLogMsgVerbose( - "frame uses %s for full UnwindPlan", + "frame uses %s for full UnwindPlan because we are falling back " + "to the arch default plan", arch_default_unwind_plan_sp->GetSourceName().GetCString()); else UnwindLogMsg( @@ -1345,7 +1351,7 @@ RegisterContextLLDB::SavedLocationForRegister( // register, we may be able to fall back to some ABI-defined default. For // example, some ABIs allow to determine the caller's SP via the CFA. Also, // the ABI may set volatile registers to the undefined state. - ABI *abi = process ? process->GetABI().get() : NULL; + ABI *abi = process ? process->GetABI().get() : nullptr; if (abi) { const RegisterInfo *reg_info = GetRegisterInfoAtIndex(regnum.GetAsKind(eRegisterKindLLDB)); @@ -1509,9 +1515,11 @@ RegisterContextLLDB::SavedLocationForRegister( DWARFExpression dwarfexpr(opcode_ctx, dwarfdata, nullptr, 0, unwindplan_regloc.GetDWARFExpressionLength()); dwarfexpr.SetRegisterKind(unwindplan_registerkind); + Value cfa_val = Scalar(m_cfa); + cfa_val.SetValueType(Value::eValueTypeLoadAddress); Value result; Status error; - if (dwarfexpr.Evaluate(&exe_ctx, this, 0, nullptr, nullptr, result, + if (dwarfexpr.Evaluate(&exe_ctx, this, 0, &cfa_val, nullptr, result, &error)) { addr_t val; val = result.GetScalar().ULongLong(); @@ -1696,10 +1704,10 @@ bool RegisterContextLLDB::TryFallbackUnwindPlan() { } bool RegisterContextLLDB::ForceSwitchToFallbackUnwindPlan() { - if (m_fallback_unwind_plan_sp.get() == NULL) + if (m_fallback_unwind_plan_sp.get() == nullptr) return false; - if (m_full_unwind_plan_sp.get() == NULL) + if (m_full_unwind_plan_sp.get() == nullptr) return false; if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() || @@ -2061,7 +2069,7 @@ void RegisterContextLLDB::UnwindLogMsg(const char *fmt, ...) { va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); @@ -2082,7 +2090,7 @@ void RegisterContextLLDB::UnwindLogMsgVerbose(const char *fmt, ...) { va_start(args, fmt); char *logmsg; - if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == NULL) { + if (vasprintf(&logmsg, fmt, args) == -1 || logmsg == nullptr) { if (logmsg) free(logmsg); va_end(args); diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.h b/source/Plugins/Process/Utility/RegisterContextLLDB.h index 50f12c6f8541..64dd394d233b 100644 --- a/source/Plugins/Process/Utility/RegisterContextLLDB.h +++ b/source/Plugins/Process/Utility/RegisterContextLLDB.h @@ -1,10 +1,9 @@ //===-- RegisterContextLLDB.h --------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -111,15 +110,13 @@ private: // user somehow. bool IsSkipFrame() const; - //------------------------------------------------------------------ /// Determines if a SymbolContext is a trap handler or not /// /// Given a SymbolContext, determines if this is a trap handler function /// aka asynchronous signal handler. /// - /// @return + /// \return /// Returns true if the SymbolContext is a trap handler. - //------------------------------------------------------------------ bool IsTrapHandlerSymbol(lldb_private::Process *process, const lldb_private::SymbolContext &m_sym_ctx) const; @@ -155,7 +152,6 @@ private: const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value); - //------------------------------------------------------------------ /// If the unwind has to the caller frame has failed, try something else /// /// If lldb is using an assembly language based UnwindPlan for a frame and @@ -164,12 +160,10 @@ private: /// better. This is mostly helping to work around problems where the /// assembly language inspection fails on hand-written assembly code. /// - /// @return + /// \return /// Returns true if a fallback unwindplan was found & was installed. - //------------------------------------------------------------------ bool TryFallbackUnwindPlan(); - //------------------------------------------------------------------ /// Switch to the fallback unwind plan unconditionally without any safety /// checks that it is providing better results than the normal unwind plan. /// @@ -177,7 +171,6 @@ private: /// found to be fundamentally incorrect/impossible. /// /// Returns true if it was able to install the fallback unwind plan. - //------------------------------------------------------------------ bool ForceSwitchToFallbackUnwindPlan(); // Get the contents of a general purpose (address-size) register for this @@ -250,9 +243,7 @@ private: lldb_private::UnwindLLDB &m_parent_unwind; // The UnwindLLDB that is creating // this RegisterContextLLDB - //------------------------------------------------------------------ // For RegisterContextLLDB only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(RegisterContextLLDB); }; diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp b/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp index 2cb17cb182e2..79979639dc7e 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_i386.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -82,9 +81,7 @@ struct UserArea { #define DR_OFFSET(reg_index) (DR_0_OFFSET + (reg_index * 4)) #define FPR_SIZE(reg) sizeof(((FPR_i386 *)NULL)->reg) -//--------------------------------------------------------------------------- // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_I386_STRUCT #include "RegisterInfos_i386.h" #undef DECLARE_REGISTER_INFOS_I386_STRUCT @@ -93,8 +90,8 @@ RegisterContextLinux_i386::RegisterContextLinux_i386( const ArchSpec &target_arch) : RegisterInfoInterface(target_arch) { RegisterInfo orig_ax = {"orig_eax", - NULL, - sizeof(((GPR *)NULL)->orig_eax), + nullptr, + sizeof(((GPR *)nullptr)->orig_eax), (LLVM_EXTENSION offsetof(GPR, orig_eax)), eEncodingUint, eFormatHex, @@ -117,7 +114,7 @@ const RegisterInfo *RegisterContextLinux_i386::GetRegisterInfo() const { return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_i386.h b/source/Plugins/Process/Utility/RegisterContextLinux_i386.h index fbf803789cc1..5567a1ac42e5 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_i386.h +++ b/source/Plugins/Process/Utility/RegisterContextLinux_i386.h @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_i386.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp b/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp index 7b16531dcc89..fc60fea79176 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_mips.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -22,9 +21,7 @@ using namespace lldb_private; using namespace lldb; -//--------------------------------------------------------------------------- // Include RegisterInfos_mips to declare our g_register_infos_mips structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_MIPS_STRUCT #include "RegisterInfos_mips.h" #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT @@ -119,7 +116,7 @@ const RegisterInfo *RegisterContextLinux_mips::GetRegisterInfo() const { return g_register_infos_mips; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_mips.h b/source/Plugins/Process/Utility/RegisterContextLinux_mips.h index a16c4ecd15f8..e637dfc15e4d 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_mips.h +++ b/source/Plugins/Process/Utility/RegisterContextLinux_mips.h @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_mips.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp b/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp index 1bb16c701126..3927883c47a4 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_mips64.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -23,19 +22,15 @@ using namespace lldb; using namespace lldb_private; -//--------------------------------------------------------------------------- // Include RegisterInfos_mips64 to declare our g_register_infos_mips64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_MIPS64_STRUCT #define LINUX_MIPS64 #include "RegisterInfos_mips64.h" #undef LINUX_MIPS64 #undef DECLARE_REGISTER_INFOS_MIPS64_STRUCT -//--------------------------------------------------------------------------- // Include RegisterInfos_mips to declare our g_register_infos_mips structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_MIPS_STRUCT #include "RegisterInfos_mips.h" #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h b/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h index d3ca9d75300e..ca0f0140a22d 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h +++ b/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_mips64.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_s390x.cpp b/source/Plugins/Process/Utility/RegisterContextLinux_s390x.cpp index 5a7f5a125246..d6401d788ab2 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_s390x.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLinux_s390x.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_s390x.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ using namespace lldb_private; using namespace lldb; -//--------------------------------------------------------------------------- // Include RegisterInfos_s390x to declare our g_register_infos_s390x structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_S390X_STRUCT #include "RegisterInfos_s390x.h" #undef DECLARE_REGISTER_INFOS_S390X_STRUCT diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_s390x.h b/source/Plugins/Process/Utility/RegisterContextLinux_s390x.h index 556cc2e12484..10810c97af80 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_s390x.h +++ b/source/Plugins/Process/Utility/RegisterContextLinux_s390x.h @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_s390x.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp index 526b3eca81ae..640d5bc02256 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_x86_64.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -76,10 +75,8 @@ struct UserArea { (LLVM_EXTENSION offsetof(UserArea, dbg) + \ LLVM_EXTENSION offsetof(DBG, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_X86_64_STRUCT #include "RegisterInfos_x86_64.h" #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT @@ -103,10 +100,8 @@ GetRegisterInfo_i386(const lldb_private::ArchSpec &arch) { g_register_infos.insert(g_register_infos.end(), &base_info[0], &base_info[k_num_registers_i386]); -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to update the g_register_infos structure // with x86_64 offsets. -//--------------------------------------------------------------------------- #define UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS #include "RegisterInfos_x86_64.h" #undef UPDATE_REGISTER_INFOS_I386_STRUCT_WITH_X86_64_OFFSETS @@ -162,8 +157,8 @@ RegisterContextLinux_x86_64::RegisterContextLinux_x86_64( m_register_info_count(GetRegisterInfoCount(target_arch)), m_user_register_count(GetUserRegisterInfoCount(target_arch)) { RegisterInfo orig_ax = {"orig_rax", - NULL, - sizeof(((GPR *)NULL)->orig_rax), + nullptr, + sizeof(((GPR *)nullptr)->orig_rax), (LLVM_EXTENSION offsetof(GPR, orig_rax)), eEncodingUint, eFormatHex, diff --git a/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h b/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h index 99a4cb736790..02f273cb02c9 100644 --- a/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterContextLinux_x86_64.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp b/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp index c0a6084cd723..bc78c1d6160c 100644 --- a/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp +++ b/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextMacOSXFrameBackchain.cpp -----------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -20,18 +19,14 @@ using namespace lldb; using namespace lldb_private; -//---------------------------------------------------------------------- // RegisterContextMacOSXFrameBackchain constructor -//---------------------------------------------------------------------- RegisterContextMacOSXFrameBackchain::RegisterContextMacOSXFrameBackchain( Thread &thread, uint32_t concrete_frame_idx, const UnwindMacOSXFrameBackchain::Cursor &cursor) : RegisterContext(thread, concrete_frame_idx), m_cursor(cursor), m_cursor_is_valid(true) {} -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- RegisterContextMacOSXFrameBackchain::~RegisterContextMacOSXFrameBackchain() {} void RegisterContextMacOSXFrameBackchain::InvalidateAllRegisters() { diff --git a/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h b/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h index 69e23c2782fd..36e5538daa8a 100644 --- a/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h +++ b/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.h @@ -1,9 +1,8 @@ //===-- RegisterContextMacOSXFrameBackchain.h -------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp b/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp index 69522ace1a68..c7042ab5137a 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp +++ b/source/Plugins/Process/Utility/RegisterContextMach_arm.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextMach_arm.cpp -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_arm.h b/source/Plugins/Process/Utility/RegisterContextMach_arm.h index 5ea47f214e25..8b2425a193be 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_arm.h +++ b/source/Plugins/Process/Utility/RegisterContextMach_arm.h @@ -1,9 +1,8 @@ //===-- RegisterContextMach_arm.h -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp b/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp index 94138605239e..e631ab9bb26c 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp +++ b/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextMach_i386.cpp ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_i386.h b/source/Plugins/Process/Utility/RegisterContextMach_i386.h index a7e29e96b267..b8835561e98c 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_i386.h +++ b/source/Plugins/Process/Utility/RegisterContextMach_i386.h @@ -1,9 +1,8 @@ //===-- RegisterContextMach_i386.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp index e523b95ee974..db17d7d88778 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextMach_x86_64.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h index c73bdda79713..688009aef8af 100644 --- a/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h @@ -1,10 +1,9 @@ //===-- RegisterContextMach_x86_64.h ------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextMemory.cpp b/source/Plugins/Process/Utility/RegisterContextMemory.cpp index f05c07f6c8e1..946d4fa9f8e5 100644 --- a/source/Plugins/Process/Utility/RegisterContextMemory.cpp +++ b/source/Plugins/Process/Utility/RegisterContextMemory.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextMemory.cpp -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -19,9 +18,7 @@ using namespace lldb; using namespace lldb_private; -//---------------------------------------------------------------------- // RegisterContextMemory constructor -//---------------------------------------------------------------------- RegisterContextMemory::RegisterContextMemory(Thread &thread, uint32_t concrete_frame_idx, DynamicRegisterInfo ®_infos, @@ -41,9 +38,7 @@ RegisterContextMemory::RegisterContextMemory(Thread &thread, m_reg_data.SetData(reg_data_sp); } -//---------------------------------------------------------------------- // Destructor -//---------------------------------------------------------------------- RegisterContextMemory::~RegisterContextMemory() {} void RegisterContextMemory::InvalidateAllRegisters() { diff --git a/source/Plugins/Process/Utility/RegisterContextMemory.h b/source/Plugins/Process/Utility/RegisterContextMemory.h index cdf2a5446e1e..68223eaeffd7 100644 --- a/source/Plugins/Process/Utility/RegisterContextMemory.h +++ b/source/Plugins/Process/Utility/RegisterContextMemory.h @@ -1,9 +1,8 @@ //===-- RegisterContextMemory.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -40,13 +39,11 @@ public: uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override; - //------------------------------------------------------------------ // If all of the thread register are in a contiguous buffer in // memory, then the default ReadRegister/WriteRegister and // ReadAllRegisterValues/WriteAllRegisterValues will work. If thread // registers are not contiguous, clients will want to subclass this // class and modify the read/write functions as needed. - //------------------------------------------------------------------ bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue ®_value) override; diff --git a/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.cpp index ca7a0139ccc0..e620ff66c922 100644 --- a/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextNetBSD_x86_64.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -78,10 +77,8 @@ struct UserArea { LLVM_EXTENSION offsetof(DBG, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_X86_64_STRUCT #include "RegisterInfos_x86_64.h" #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT diff --git a/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h b/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h index 6b1998148d61..4820ef8d17ba 100644 --- a/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterContextNetBSD_x86_64.h -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp b/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp index 1f958105b10b..06eac6f7f991 100644 --- a/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp +++ b/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextOpenBSD_i386.cpp ------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -51,9 +50,7 @@ struct UserArea { #define DR_SIZE sizeof(uint32_t) #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(dbreg, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_i386 to declare our g_register_infos_i386 structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_I386_STRUCT #include "RegisterInfos_i386.h" #undef DECLARE_REGISTER_INFOS_I386_STRUCT @@ -70,7 +67,7 @@ const RegisterInfo *RegisterContextOpenBSD_i386::GetRegisterInfo() const { return g_register_infos_i386; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h b/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h index d3c13008bece..992ce0959fdf 100644 --- a/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h +++ b/source/Plugins/Process/Utility/RegisterContextOpenBSD_i386.h @@ -1,9 +1,8 @@ //===-- RegisterContextOpenBSD_i386.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp b/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp index e7ff0732ffec..e210196d921d 100644 --- a/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextOpenBSD_x86_64.cpp ----------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -59,10 +58,8 @@ struct UserArea { #define DR_OFFSET(reg_index) (LLVM_EXTENSION offsetof(DBG, dr[reg_index])) -//--------------------------------------------------------------------------- // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 // structure. -//--------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_X86_64_STRUCT #include "RegisterInfos_x86_64.h" #undef DECLARE_REGISTER_INFOS_X86_64_STRUCT diff --git a/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h b/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h index aa2b7733f389..9c76e7211132 100644 --- a/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterContextOpenBSD_x86_64.h -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp index b0e53cfcc91f..821e2aa73b5b 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_arm.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -87,7 +86,7 @@ RegisterContextPOSIX_arm::RegisterContextPOSIX_arm( lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info) : lldb_private::RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); switch (register_info->m_target_arch.GetMachine()) { case llvm::Triple::arm: @@ -132,14 +131,14 @@ size_t RegisterContextPOSIX_arm::GetRegisterCount() { } size_t RegisterContextPOSIX_arm::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } const lldb_private::RegisterInfo *RegisterContextPOSIX_arm::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const lldb_private::RegisterInfo * @@ -147,7 +146,7 @@ RegisterContextPOSIX_arm::GetRegisterInfoAtIndex(size_t reg) { if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_arm::GetRegisterSetCount() { @@ -163,15 +162,15 @@ size_t RegisterContextPOSIX_arm::GetRegisterSetCount() { const lldb_private::RegisterSet * RegisterContextPOSIX_arm::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) { - switch (m_register_info_ap->m_target_arch.GetMachine()) { + switch (m_register_info_up->m_target_arch.GetMachine()) { case llvm::Triple::arm: return &g_reg_sets_arm[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_arm::GetRegisterName(unsigned reg) { diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h index 4b5a8fe95a4f..603ba76430e6 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_arm.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -84,7 +83,7 @@ protected: struct RegisterContextPOSIX_arm::FPU m_fpr; // floating-point registers including extended register sets. std::unique_ptr<lldb_private::RegisterInfoInterface> - m_register_info_ap; // Register Info Interface (FreeBSD or Linux) + m_register_info_up; // Register Info Interface (FreeBSD or Linux) // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp index 8b00dfc81eab..99b897d441b5 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_arm64.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -106,7 +105,7 @@ RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64( lldb_private::Thread &thread, uint32_t concrete_frame_idx, lldb_private::RegisterInfoInterface *register_info) : lldb_private::RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); switch (register_info->m_target_arch.GetMachine()) { case llvm::Triple::aarch64: @@ -151,7 +150,7 @@ size_t RegisterContextPOSIX_arm64::GetRegisterCount() { } size_t RegisterContextPOSIX_arm64::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } const lldb_private::RegisterInfo * @@ -159,7 +158,7 @@ RegisterContextPOSIX_arm64::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const lldb_private::RegisterInfo * @@ -167,7 +166,7 @@ RegisterContextPOSIX_arm64::GetRegisterInfoAtIndex(size_t reg) { if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_arm64::GetRegisterSetCount() { @@ -183,15 +182,15 @@ size_t RegisterContextPOSIX_arm64::GetRegisterSetCount() { const lldb_private::RegisterSet * RegisterContextPOSIX_arm64::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) { - switch (m_register_info_ap->m_target_arch.GetMachine()) { + switch (m_register_info_up->m_target_arch.GetMachine()) { case llvm::Triple::aarch64: return &g_reg_sets_arm64[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_arm64::GetRegisterName(unsigned reg) { diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h index 603c12d830d9..49a49b69da6b 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_arm64.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -84,7 +83,7 @@ protected: struct RegisterContextPOSIX_arm64::FPU m_fpr; // floating-point registers including extended register sets. std::unique_ptr<lldb_private::RegisterInfoInterface> - m_register_info_ap; // Register Info Interface (FreeBSD or Linux) + m_register_info_up; // Register Info Interface (FreeBSD or Linux) // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp index 9270d09f7293..f1fa3035b2ef 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_mips64.cpp -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -45,7 +44,7 @@ RegisterContextPOSIX_mips64::RegisterContextPOSIX_mips64( Thread &thread, uint32_t concrete_frame_idx, RegisterInfoInterface *register_info) : RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); m_num_registers = GetRegisterCount(); int set = GetRegisterSetCount(); @@ -78,18 +77,18 @@ unsigned RegisterContextPOSIX_mips64::GetRegisterSize(unsigned reg) { } size_t RegisterContextPOSIX_mips64::GetRegisterCount() { - return m_register_info_ap->GetRegisterCount(); + return m_register_info_up->GetRegisterCount(); } size_t RegisterContextPOSIX_mips64::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } const RegisterInfo *RegisterContextPOSIX_mips64::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const RegisterInfo * @@ -97,26 +96,26 @@ RegisterContextPOSIX_mips64::GetRegisterInfoAtIndex(size_t reg) { if (reg < m_num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_mips64::GetRegisterSetCount() { - ArchSpec target_arch = m_register_info_ap->GetTargetArchitecture(); + ArchSpec target_arch = m_register_info_up->GetTargetArchitecture(); switch (target_arch.GetTriple().getOS()) { case llvm::Triple::Linux: { if ((target_arch.GetMachine() == llvm::Triple::mipsel) || (target_arch.GetMachine() == llvm::Triple::mips)) { - const auto *context = static_cast<const RegisterContextLinux_mips *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextLinux_mips *>( + m_register_info_up.get()); return context->GetRegisterSetCount(); } - const auto *context = static_cast<const RegisterContextLinux_mips64 *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextLinux_mips64 *>( + m_register_info_up.get()); return context->GetRegisterSetCount(); } default: { - const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>( + m_register_info_up.get()); return context->GetRegisterSetCount(); } @@ -124,22 +123,22 @@ size_t RegisterContextPOSIX_mips64::GetRegisterSetCount() { } const RegisterSet *RegisterContextPOSIX_mips64::GetRegisterSet(size_t set) { - ArchSpec target_arch = m_register_info_ap->GetTargetArchitecture(); + ArchSpec target_arch = m_register_info_up->GetTargetArchitecture(); switch (target_arch.GetTriple().getOS()) { case llvm::Triple::Linux: { if ((target_arch.GetMachine() == llvm::Triple::mipsel) || (target_arch.GetMachine() == llvm::Triple::mips)) { - const auto *context = static_cast<const RegisterContextLinux_mips *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextLinux_mips *>( + m_register_info_up.get()); return context->GetRegisterSet(set); } - const auto *context = static_cast<const RegisterContextLinux_mips64 *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextLinux_mips64 *>( + m_register_info_up.get()); return context->GetRegisterSet(set); } default: { - const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *> - (m_register_info_ap.get()); + const auto *context = static_cast<const RegisterContextFreeBSD_mips64 *>( + m_register_info_up.get()); return context->GetRegisterSet(set); } } diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h index 09cfd42b9c51..c507e14bd5b6 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_mips64.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -62,7 +61,7 @@ protected: uint32_t m_num_registers; uint8_t m_registers_count[register_set_count]; std::unique_ptr<lldb_private::RegisterInfoInterface> - m_register_info_ap; // Register Info Interface (FreeBSD or Linux) + m_register_info_up; // Register Info Interface (FreeBSD or Linux) // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp index 47a8e2c3f9e9..a78e9ed37947 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp @@ -1,10 +1,9 @@ //===-- RegisterContextPOSIX_powerpc.cpp -------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -94,7 +93,7 @@ RegisterContextPOSIX_powerpc::RegisterContextPOSIX_powerpc( Thread &thread, uint32_t concrete_frame_idx, RegisterInfoInterface *register_info) : RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); } RegisterContextPOSIX_powerpc::~RegisterContextPOSIX_powerpc() {} @@ -119,14 +118,14 @@ size_t RegisterContextPOSIX_powerpc::GetRegisterCount() { } size_t RegisterContextPOSIX_powerpc::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } const RegisterInfo *RegisterContextPOSIX_powerpc::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const RegisterInfo * @@ -134,7 +133,7 @@ RegisterContextPOSIX_powerpc::GetRegisterInfoAtIndex(size_t reg) { if (reg < k_num_registers_powerpc) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_powerpc::GetRegisterSetCount() { @@ -151,7 +150,7 @@ const RegisterSet *RegisterContextPOSIX_powerpc::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) return &g_reg_sets_powerpc[set]; else - return NULL; + return nullptr; } const char *RegisterContextPOSIX_powerpc::GetRegisterName(unsigned reg) { diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h index 3260cb1ce8bc..1a21a717b22b 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_powerpc.h --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -17,9 +16,7 @@ class ProcessMonitor; -// --------------------------------------------------------------------------- // Internal codes for all powerpc registers. -// --------------------------------------------------------------------------- enum { k_first_gpr_powerpc, gpr_r0_powerpc = k_first_gpr_powerpc, @@ -178,7 +175,7 @@ protected: m_fpr_powerpc[k_num_fpr_registers_powerpc]; // floating point registers. uint32_t m_vmx_powerpc[k_num_vmx_registers_powerpc][4]; std::unique_ptr<lldb_private::RegisterInfoInterface> - m_register_info_ap; // Register Info Interface (FreeBSD or Linux) + m_register_info_up; // Register Info Interface (FreeBSD or Linux) // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp index ef221c963dc4..02546c0ed16f 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_ppc64le.cpp -------------------------*- C++-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -116,7 +115,7 @@ RegisterContextPOSIX_ppc64le::RegisterContextPOSIX_ppc64le( Thread &thread, uint32_t concrete_frame_idx, RegisterInfoInterface *register_info) : RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); } void RegisterContextPOSIX_ppc64le::InvalidateAllRegisters() {} @@ -137,14 +136,14 @@ size_t RegisterContextPOSIX_ppc64le::GetRegisterCount() { } size_t RegisterContextPOSIX_ppc64le::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } const RegisterInfo *RegisterContextPOSIX_ppc64le::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const RegisterInfo * @@ -152,7 +151,7 @@ RegisterContextPOSIX_ppc64le::GetRegisterInfoAtIndex(size_t reg) { if (reg < k_num_registers_ppc64le) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_ppc64le::GetRegisterSetCount() { @@ -169,7 +168,7 @@ const RegisterSet *RegisterContextPOSIX_ppc64le::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) return &g_reg_sets_ppc64le[set]; else - return NULL; + return nullptr; } const char *RegisterContextPOSIX_ppc64le::GetRegisterName(unsigned reg) { diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h index 9159819f17c4..37079775a3c7 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_ppc64le.h --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -56,7 +55,7 @@ protected: // VSX registers. uint64_t m_vsx_ppc64le[k_num_vsx_registers_ppc64le * 2]; - std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; + std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_up; // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp index 24f131099be4..e040e5075721 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_s390x.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -82,7 +81,7 @@ RegisterContextPOSIX_s390x::RegisterContextPOSIX_s390x( Thread &thread, uint32_t concrete_frame_idx, RegisterInfoInterface *register_info) : RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); switch (register_info->m_target_arch.GetMachine()) { case llvm::Triple::systemz: @@ -106,7 +105,7 @@ void RegisterContextPOSIX_s390x::Invalidate() {} void RegisterContextPOSIX_s390x::InvalidateAllRegisters() {} const RegisterInfo *RegisterContextPOSIX_s390x::GetRegisterInfo() { - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const RegisterInfo * @@ -114,7 +113,7 @@ RegisterContextPOSIX_s390x::GetRegisterInfoAtIndex(size_t reg) { if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_s390x::GetRegisterCount() { @@ -152,15 +151,15 @@ size_t RegisterContextPOSIX_s390x::GetRegisterSetCount() { const RegisterSet *RegisterContextPOSIX_s390x::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) { - switch (m_register_info_ap->m_target_arch.GetMachine()) { + switch (m_register_info_up->m_target_arch.GetMachine()) { case llvm::Triple::systemz: return &g_reg_sets_s390x[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } lldb::ByteOrder RegisterContextPOSIX_s390x::GetByteOrder() { diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h index 7a7b6bddd6aa..54993ce6c3ec 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_s390x.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -59,7 +58,7 @@ protected: }; RegInfo m_reg_info; - std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; + std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_up; virtual bool IsRegisterSetAvailable(size_t set_index); diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp index 78f561a0f04f..4d5991f08f1d 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_x86.cpp ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -319,7 +318,7 @@ RegisterContextPOSIX_x86::RegisterContextPOSIX_x86( Thread &thread, uint32_t concrete_frame_idx, RegisterInfoInterface *register_info) : RegisterContext(thread, concrete_frame_idx) { - m_register_info_ap.reset(register_info); + m_register_info_up.reset(register_info); switch (register_info->m_target_arch.GetMachine()) { case llvm::Triple::x86: @@ -405,7 +404,7 @@ size_t RegisterContextPOSIX_x86::GetRegisterCount() { } size_t RegisterContextPOSIX_x86::GetGPRSize() { - return m_register_info_ap->GetGPRSize(); + return m_register_info_up->GetGPRSize(); } size_t RegisterContextPOSIX_x86::GetFXSAVEOffset() { @@ -416,7 +415,7 @@ const RegisterInfo *RegisterContextPOSIX_x86::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and // specialized. So, use GetRegisterInfo() rather than g_register_infos in // this scope. - return m_register_info_ap->GetRegisterInfo(); + return m_register_info_up->GetRegisterInfo(); } const RegisterInfo * @@ -424,7 +423,7 @@ RegisterContextPOSIX_x86::GetRegisterInfoAtIndex(size_t reg) { if (reg < m_reg_info.num_registers) return &GetRegisterInfo()[reg]; else - return NULL; + return nullptr; } size_t RegisterContextPOSIX_x86::GetRegisterSetCount() { @@ -439,17 +438,17 @@ size_t RegisterContextPOSIX_x86::GetRegisterSetCount() { const RegisterSet *RegisterContextPOSIX_x86::GetRegisterSet(size_t set) { if (IsRegisterSetAvailable(set)) { - switch (m_register_info_ap->m_target_arch.GetMachine()) { + switch (m_register_info_up->m_target_arch.GetMachine()) { case llvm::Triple::x86: return &g_reg_sets_i386[set]; case llvm::Triple::x86_64: return &g_reg_sets_x86_64[set]; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } - return NULL; + return nullptr; } const char *RegisterContextPOSIX_x86::GetRegisterName(unsigned reg) { @@ -475,22 +474,13 @@ bool RegisterContextPOSIX_x86::CopyYMMtoXSTATE(uint32_t reg, return false; if (byte_order == eByteOrderLittle) { - ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes, - m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(XMMReg)); - ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes, - m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg), - sizeof(YMMHReg)); + uint32_t reg_no = reg - m_reg_info.first_ymm; + YMMToXState(m_ymm_set.ymm[reg_no], + m_fpr.fxsave.xmm[reg_no].bytes, + m_fpr.xsave.ymmh[reg_no].bytes); return true; } - if (byte_order == eByteOrderBig) { - ::memcpy(m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes, - m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg), - sizeof(XMMReg)); - ::memcpy(m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes, - m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, sizeof(YMMHReg)); - return true; - } return false; // unsupported or invalid byte order } @@ -501,24 +491,13 @@ bool RegisterContextPOSIX_x86::CopyXSTATEtoYMM(uint32_t reg, return false; if (byte_order == eByteOrderLittle) { - ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, - m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes, - sizeof(XMMReg)); - ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg), - m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes, - sizeof(YMMHReg)); + uint32_t reg_no = reg - m_reg_info.first_ymm; + m_ymm_set.ymm[reg_no] = XStateToYMM( + m_fpr.fxsave.xmm[reg_no].bytes, + m_fpr.xsave.ymmh[reg_no].bytes); return true; } - if (byte_order == eByteOrderBig) { - ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg), - m_fpr.fxsave.xmm[reg - m_reg_info.first_ymm].bytes, - sizeof(XMMReg)); - ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, - m_fpr.xsave.ymmh[reg - m_reg_info.first_ymm].bytes, - sizeof(YMMHReg)); - return true; - } return false; // unsupported or invalid byte order } diff --git a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h index b6db45e55bbf..932f97bb567f 100644 --- a/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h +++ b/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h @@ -1,9 +1,8 @@ //===-- RegisterContextPOSIX_x86.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -51,9 +50,7 @@ public: uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override; - //--------------------------------------------------------------------------- // Note: prefer kernel definitions over user-land - //--------------------------------------------------------------------------- enum FPRType { eNotValid = 0, eFSAVE, // TODO @@ -149,7 +146,7 @@ protected: // register sets. lldb_private::YMM m_ymm_set; // copy of ymmh and xmm register halves. std::unique_ptr<lldb_private::RegisterInfoInterface> - m_register_info_ap; // Register Info Interface (FreeBSD or Linux) + m_register_info_up; // Register Info Interface (FreeBSD or Linux) // Determines if an extended register set is supported on the processor // running the inferior process. diff --git a/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp index 96ad139f7364..bcf60cc7a338 100644 --- a/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp +++ b/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp @@ -1,9 +1,8 @@ //===-- RegisterContextThreadMemory.cpp -------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -55,9 +54,7 @@ void RegisterContextThreadMemory::UpdateRegisterContext() { } } -//------------------------------------------------------------------ // Subclasses must override these functions -//------------------------------------------------------------------ void RegisterContextThreadMemory::InvalidateAllRegisters() { UpdateRegisterContext(); if (m_reg_ctx_sp) @@ -76,7 +73,7 @@ RegisterContextThreadMemory::GetRegisterInfoAtIndex(size_t reg) { UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->GetRegisterInfoAtIndex(reg); - return NULL; + return nullptr; } size_t RegisterContextThreadMemory::GetRegisterSetCount() { @@ -90,7 +87,7 @@ const RegisterSet *RegisterContextThreadMemory::GetRegisterSet(size_t reg_set) { UpdateRegisterContext(); if (m_reg_ctx_sp) return m_reg_ctx_sp->GetRegisterSet(reg_set); - return NULL; + return nullptr; } bool RegisterContextThreadMemory::ReadRegister(const RegisterInfo *reg_info, diff --git a/source/Plugins/Process/Utility/RegisterContextThreadMemory.h b/source/Plugins/Process/Utility/RegisterContextThreadMemory.h index 0d50c73a31a9..09a679ab2c9f 100644 --- a/source/Plugins/Process/Utility/RegisterContextThreadMemory.h +++ b/source/Plugins/Process/Utility/RegisterContextThreadMemory.h @@ -1,9 +1,8 @@ //===-- RegisterContextThreadMemory.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContext_mips.h b/source/Plugins/Process/Utility/RegisterContext_mips.h index da470bd82732..7780be51baad 100644 --- a/source/Plugins/Process/Utility/RegisterContext_mips.h +++ b/source/Plugins/Process/Utility/RegisterContext_mips.h @@ -1,9 +1,8 @@ //===-- RegisterContext_mips.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContext_powerpc.h b/source/Plugins/Process/Utility/RegisterContext_powerpc.h index 73242952c6d0..1ffcbeb5ec48 100644 --- a/source/Plugins/Process/Utility/RegisterContext_powerpc.h +++ b/source/Plugins/Process/Utility/RegisterContext_powerpc.h @@ -1,10 +1,9 @@ //===-- RegisterContext_powerpc.h --------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterContext_s390x.h b/source/Plugins/Process/Utility/RegisterContext_s390x.h index 90803dc16785..2cf39e9eb8e2 100644 --- a/source/Plugins/Process/Utility/RegisterContext_s390x.h +++ b/source/Plugins/Process/Utility/RegisterContext_s390x.h @@ -1,18 +1,15 @@ //===-- RegisterContext_s390x.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// #ifndef liblldb_RegisterContext_s390x_h_ #define liblldb_RegisterContext_s390x_h_ -//--------------------------------------------------------------------------- // SystemZ ehframe, dwarf regnums -//--------------------------------------------------------------------------- // EHFrame and DWARF Register numbers (eRegisterKindEHFrame & // eRegisterKindDWARF) diff --git a/source/Plugins/Process/Utility/RegisterContext_x86.h b/source/Plugins/Process/Utility/RegisterContext_x86.h index e3ff492d707a..2b79f778aa56 100644 --- a/source/Plugins/Process/Utility/RegisterContext_x86.h +++ b/source/Plugins/Process/Utility/RegisterContext_x86.h @@ -1,9 +1,8 @@ //===-- RegisterContext_x86.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -17,9 +16,7 @@ #include "llvm/Support/Compiler.h" namespace lldb_private { -//--------------------------------------------------------------------------- // i386 ehframe, dwarf regnums -//--------------------------------------------------------------------------- // Register numbers seen in eh_frame (eRegisterKindEHFrame) on i386 systems // (non-Darwin) @@ -132,9 +129,7 @@ enum { dwarf_bnd3_i386, }; -//--------------------------------------------------------------------------- // AMD x86_64, AMD64, Intel EM64T, or Intel 64 ehframe, dwarf regnums -//--------------------------------------------------------------------------- // EHFrame and DWARF Register numbers (eRegisterKindEHFrame & // eRegisterKindDWARF) @@ -242,9 +237,7 @@ enum { // dwarf_k7_x86_64, }; -//--------------------------------------------------------------------------- // Generic floating-point registers -//--------------------------------------------------------------------------- struct MMSReg { uint8_t bytes[10]; @@ -283,9 +276,7 @@ struct FXSAVE { uint8_t padding2[40]; }; -//--------------------------------------------------------------------------- // Extended floating-point registers -//--------------------------------------------------------------------------- struct YMMHReg { uint8_t bytes[16]; // 16 * 8 bits for the high bytes of each YMM register @@ -341,7 +332,7 @@ LLVM_PACKED_END // x86 extensions to FXSAVE (i.e. for AVX and MPX processors) LLVM_PACKED_START -struct LLVM_ALIGNAS(16) XSAVE { +struct XSAVE { FXSAVE i387; // floating point registers typical in i387_fxsave_struct XSAVE_HDR header; // The xsave_hdr_struct can be used to determine if the // following extensions are usable @@ -362,6 +353,22 @@ union FPR { LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); +// Convenience function to combine YMM register data from XSAVE-style input. +inline YMMReg XStateToYMM(const void* xmm_bytes, const void* ymmh_bytes) { + YMMReg ret; + + ::memcpy(ret.bytes, xmm_bytes, sizeof(XMMReg)); + ::memcpy(ret.bytes + sizeof(XMMReg), ymmh_bytes, sizeof(YMMHReg)); + + return ret; +} + +// Convenience function to copy YMM register data into XSAVE-style output. +inline void YMMToXState(const YMMReg& input, void* xmm_bytes, void* ymmh_bytes) { + ::memcpy(xmm_bytes, input.bytes, sizeof(XMMReg)); + ::memcpy(ymmh_bytes, input.bytes + sizeof(XMMReg), sizeof(YMMHReg)); +} + } // namespace lldb_private #endif diff --git a/source/Plugins/Process/Utility/RegisterInfoInterface.h b/source/Plugins/Process/Utility/RegisterInfoInterface.h index 5d7ad89ad394..4b58e749adce 100644 --- a/source/Plugins/Process/Utility/RegisterInfoInterface.h +++ b/source/Plugins/Process/Utility/RegisterInfoInterface.h @@ -1,9 +1,8 @@ //===-- RegisterInfoInterface.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -16,11 +15,9 @@ namespace lldb_private { -///------------------------------------------------------------------------------ -/// @class RegisterInfoInterface +/// \class RegisterInfoInterface /// /// RegisterInfo interface to patch RegisterInfo structure for archs. -///------------------------------------------------------------------------------ class RegisterInfoInterface { public: RegisterInfoInterface(const lldb_private::ArchSpec &target_arch) diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp index 0111b842509b..d392d3be1c41 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.cpp @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_arm.cpp ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -44,9 +43,7 @@ using namespace lldb_private; (sizeof(RegisterInfoPOSIX_arm::GPR) + sizeof(RegisterInfoPOSIX_arm::FPU) + \ sizeof(RegisterInfoPOSIX_arm::EXC)) -//----------------------------------------------------------------------------- // Include RegisterInfos_arm to declare our g_register_infos_arm structure. -//----------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_ARM_STRUCT #include "RegisterInfos_arm.h" #undef DECLARE_REGISTER_INFOS_ARM_STRUCT @@ -58,7 +55,7 @@ GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) { return g_register_infos_arm; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.h b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.h index d90aec1c5116..39c2047600aa 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.h +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm.h @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_arm.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp index 1b145e0a173b..f7471526d054 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_arm64.cpp ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -49,9 +48,7 @@ sizeof(RegisterInfoPOSIX_arm64::FPU) + \ sizeof(RegisterInfoPOSIX_arm64::EXC)) -//----------------------------------------------------------------------------- // Include RegisterInfos_arm64 to declare our g_register_infos_arm64 structure. -//----------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_ARM64_STRUCT #include "RegisterInfos_arm64.h" #undef DECLARE_REGISTER_INFOS_ARM64_STRUCT @@ -63,7 +60,7 @@ GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) { return g_register_infos_arm64_le; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h index af770760cbf4..ace179a81814 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_arm64.h -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp index e5e7350fe68a..35051a3ce095 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_ppc64le.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// @@ -16,9 +15,7 @@ #include "RegisterInfoPOSIX_ppc64le.h" -//----------------------------------------------------------------------------- // Include RegisterInfoPOSIX_ppc64le to declare our g_register_infos_ppc64le -//----------------------------------------------------------------------------- #define DECLARE_REGISTER_INFOS_PPC64LE_STRUCT #include "RegisterInfos_ppc64le.h" #undef DECLARE_REGISTER_INFOS_PPC64LE_STRUCT @@ -30,7 +27,7 @@ GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) { return g_register_infos_ppc64le; default: assert(false && "Unhandled target architecture."); - return NULL; + return nullptr; } } diff --git a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h index 411ab05c2b13..c4d4d3b546e2 100644 --- a/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h +++ b/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h @@ -1,9 +1,8 @@ //===-- RegisterInfoPOSIX_ppc64le.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_arm.h b/source/Plugins/Process/Utility/RegisterInfos_arm.h index ec951ea8a391..74b9e3b2db32 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_arm.h +++ b/source/Plugins/Process/Utility/RegisterInfos_arm.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_arm.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_arm64.h b/source/Plugins/Process/Utility/RegisterInfos_arm64.h index 039d98ecdd2d..4ee0b528f229 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_arm64.h +++ b/source/Plugins/Process/Utility/RegisterInfos_arm64.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_arm64.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_i386.h b/source/Plugins/Process/Utility/RegisterInfos_i386.h index f8947876d15f..72ff904520ad 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_i386.h +++ b/source/Plugins/Process/Utility/RegisterInfos_i386.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_i386.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_mips.h b/source/Plugins/Process/Utility/RegisterInfos_mips.h index 36483c068d26..08201fd1191c 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_mips.h +++ b/source/Plugins/Process/Utility/RegisterInfos_mips.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_mips.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_mips64.h b/source/Plugins/Process/Utility/RegisterInfos_mips64.h index 0194074f34f2..b6e218ea4414 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_mips64.h +++ b/source/Plugins/Process/Utility/RegisterInfos_mips64.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_mips64.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_powerpc.h b/source/Plugins/Process/Utility/RegisterInfos_powerpc.h index c0d47f0d991f..51be31f8e028 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_powerpc.h +++ b/source/Plugins/Process/Utility/RegisterInfos_powerpc.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_powerpc.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===---------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_ppc64.h b/source/Plugins/Process/Utility/RegisterInfos_ppc64.h index dbd87ad71a45..1086d3db0b06 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_ppc64.h +++ b/source/Plugins/Process/Utility/RegisterInfos_ppc64.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_ppc64.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h b/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h index e6fa17b60758..0b099a53d875 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h +++ b/source/Plugins/Process/Utility/RegisterInfos_ppc64le.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_ppc64le.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_s390x.h b/source/Plugins/Process/Utility/RegisterInfos_s390x.h index b750be4116a5..11344ff8ee79 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_s390x.h +++ b/source/Plugins/Process/Utility/RegisterInfos_s390x.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_s390x.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/RegisterInfos_x86_64.h b/source/Plugins/Process/Utility/RegisterInfos_x86_64.h index 651536cb6045..4a3b3c73fd6b 100644 --- a/source/Plugins/Process/Utility/RegisterInfos_x86_64.h +++ b/source/Plugins/Process/Utility/RegisterInfos_x86_64.h @@ -1,9 +1,8 @@ //===-- RegisterInfos_x86_64.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/StopInfoMachException.cpp b/source/Plugins/Process/Utility/StopInfoMachException.cpp index de0821eb4253..588015a51ef1 100644 --- a/source/Plugins/Process/Utility/StopInfoMachException.cpp +++ b/source/Plugins/Process/Utility/StopInfoMachException.cpp @@ -1,9 +1,8 @@ //===-- StopInfoMachException.cpp -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -38,11 +37,11 @@ const char *StopInfoMachException::GetDescription() { target ? target->GetArchitecture().GetMachine() : llvm::Triple::UnknownArch; - const char *exc_desc = NULL; + const char *exc_desc = nullptr; const char *code_label = "code"; - const char *code_desc = NULL; + const char *code_desc = nullptr; const char *subcode_label = "subcode"; - const char *subcode_desc = NULL; + const char *subcode_desc = nullptr; #if defined(__APPLE__) char code_desc_buf[32]; @@ -594,7 +593,7 @@ StopInfoSP StopInfoMachException::CreateStopReasonWithMachException( // the thread ID so we must always report the breakpoint regardless // of the thread. if (bp_site_sp->ValidForThisThread(&thread) || - thread.GetProcess()->GetOperatingSystem() != NULL) + thread.GetProcess()->GetOperatingSystem() != nullptr) return StopInfo::CreateStopReasonWithBreakpointSiteID( thread, bp_site_sp->GetID()); else if (is_trace_if_actual_breakpoint_missing) diff --git a/source/Plugins/Process/Utility/StopInfoMachException.h b/source/Plugins/Process/Utility/StopInfoMachException.h index 027ed80e8a98..74c05812ab00 100644 --- a/source/Plugins/Process/Utility/StopInfoMachException.h +++ b/source/Plugins/Process/Utility/StopInfoMachException.h @@ -1,9 +1,8 @@ //===-- StopInfoMachException.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -18,9 +17,7 @@ namespace lldb_private { class StopInfoMachException : public StopInfo { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StopInfoMachException(Thread &thread, uint32_t exc_type, uint32_t exc_data_count, uint64_t exc_code, uint64_t exc_subcode) diff --git a/source/Plugins/Process/Utility/ThreadMemory.cpp b/source/Plugins/Process/Utility/ThreadMemory.cpp index 0c7c195815a4..80b04bb14f77 100644 --- a/source/Plugins/Process/Utility/ThreadMemory.cpp +++ b/source/Plugins/Process/Utility/ThreadMemory.cpp @@ -1,14 +1,14 @@ //===-- ThreadMemory.cpp ----------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// #include "Plugins/Process/Utility/ThreadMemory.h" + #include "Plugins/Process/Utility/RegisterContextThreadMemory.h" #include "lldb/Target/OperatingSystem.h" #include "lldb/Target/Process.h" @@ -16,6 +16,8 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Unwind.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -45,8 +47,8 @@ void ThreadMemory::ClearStackFrames() { RegisterContextSP ThreadMemory::GetRegisterContext() { if (!m_reg_context_sp) - m_reg_context_sp.reset( - new RegisterContextThreadMemory(*this, m_register_data_addr)); + m_reg_context_sp = std::make_shared<RegisterContextThreadMemory>( + *this, m_register_data_addr); return m_reg_context_sp; } diff --git a/source/Plugins/Process/Utility/ThreadMemory.h b/source/Plugins/Process/Utility/ThreadMemory.h index c966ca03a017..85bc1451e4a0 100644 --- a/source/Plugins/Process/Utility/ThreadMemory.h +++ b/source/Plugins/Process/Utility/ThreadMemory.h @@ -1,9 +1,8 @@ //===-- ThreadMemory.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// diff --git a/source/Plugins/Process/Utility/UnwindLLDB.cpp b/source/Plugins/Process/Utility/UnwindLLDB.cpp index b34c87230bd1..38209fb24948 100644 --- a/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -1,9 +1,8 @@ //===-- UnwindLLDB.cpp -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -51,7 +50,7 @@ uint32_t UnwindLLDB::DoGetFrameCount() { return 0; ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (AddOneMoreFrame(abi)) { #if DEBUG_FRAME_SPEED @@ -74,13 +73,13 @@ bool UnwindLLDB::AddFirstFrame() { return true; ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; // First, set up the 0th (initial) frame CursorSP first_cursor_sp(new Cursor()); RegisterContextLLDBSP reg_ctx_sp(new RegisterContextLLDB( m_thread, RegisterContextLLDBSP(), first_cursor_sp->sctx, 0, *this)); - if (reg_ctx_sp.get() == NULL) + if (reg_ctx_sp.get() == nullptr) goto unwind_done; if (!reg_ctx_sp->IsValid()) @@ -148,7 +147,7 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneMoreFrame(ABI *abi) { return nullptr; } - if (reg_ctx_sp.get() == NULL) { + if (reg_ctx_sp.get() == nullptr) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to // that and return true. Subsequent calls to TryFallbackUnwindPlan() will // return false. @@ -403,7 +402,7 @@ bool UnwindLLDB::DoGetFrameInfoAtIndex(uint32_t idx, addr_t &cfa, addr_t &pc) { } ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (idx >= m_frames.size() && AddOneMoreFrame(abi)) ; @@ -431,7 +430,7 @@ UnwindLLDB::DoCreateRegisterContextForFrame(StackFrame *frame) { } ProcessSP process_sp(m_thread.GetProcess()); - ABI *abi = process_sp ? process_sp->GetABI().get() : NULL; + ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; while (idx >= m_frames.size()) { if (!AddOneMoreFrame(abi)) diff --git a/source/Plugins/Process/Utility/UnwindLLDB.h b/source/Plugins/Process/Utility/UnwindLLDB.h index aec7b66d9354..c512929c185b 100644 --- a/source/Plugins/Process/Utility/UnwindLLDB.h +++ b/source/Plugins/Process/Utility/UnwindLLDB.h @@ -1,9 +1,8 @@ //===-- UnwindLLDB.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -94,7 +93,6 @@ protected: uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_register); - //------------------------------------------------------------------ /// Provide the list of user-specified trap handler functions /// /// The Platform is one source of trap handler function names; that @@ -102,10 +100,9 @@ protected: /// into an array of ConstStrings before it can be used - we only want /// to do that once per thread so it's here in the UnwindLLDB object. /// - /// @return + /// \return /// Vector of ConstStrings of trap handler function names. May be /// empty. - //------------------------------------------------------------------ const std::vector<ConstString> &GetUserSpecifiedTrapHandlerFunctionNames() { return m_user_supplied_trap_handler_functions; } @@ -139,12 +136,10 @@ private: std::vector<ConstString> m_user_supplied_trap_handler_functions; - //----------------------------------------------------------------- // Check if Full UnwindPlan of First frame is valid or not. // If not then try Fallback UnwindPlan of the frame. If Fallback // UnwindPlan succeeds then update the Full UnwindPlan with the // Fallback UnwindPlan. - //----------------------------------------------------------------- void UpdateUnwindPlanForFirstFrameIfInvalid(ABI *abi); CursorSP GetOneMoreFrame(ABI *abi); @@ -153,9 +148,7 @@ private: bool AddFirstFrame(); - //------------------------------------------------------------------ // For UnwindLLDB only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(UnwindLLDB); }; diff --git a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index ae0b9fb0a526..7dc5a5f5fdd1 100644 --- a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -1,9 +1,8 @@ //===-- UnwindMacOSXFrameBackchain.cpp --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -18,6 +17,8 @@ #include "RegisterContextMacOSXFrameBackchain.h" +#include <memory> + using namespace lldb; using namespace lldb_private; @@ -66,8 +67,8 @@ UnwindMacOSXFrameBackchain::DoCreateRegisterContextForFrame(StackFrame *frame) { uint32_t concrete_idx = frame->GetConcreteFrameIndex(); const uint32_t frame_count = GetFrameCount(); if (concrete_idx < frame_count) - reg_ctx_sp.reset(new RegisterContextMacOSXFrameBackchain( - m_thread, concrete_idx, m_cursors[concrete_idx])); + reg_ctx_sp = std::make_shared<RegisterContextMacOSXFrameBackchain>( + m_thread, concrete_idx, m_cursors[concrete_idx]); return reg_ctx_sp; } @@ -78,7 +79,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386( StackFrame *first_frame = exe_ctx.GetFramePtr(); Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return 0; struct Frame_i386 { @@ -120,7 +121,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386( SymbolContext first_frame_sc( first_frame->GetSymbolContext(resolve_scope)); - const AddressRange *addr_range_ptr = NULL; + const AddressRange *addr_range_ptr = nullptr; AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); @@ -168,7 +169,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64( m_cursors.clear(); Process *process = exe_ctx.GetProcessPtr(); - if (process == NULL) + if (process == nullptr) return 0; StackFrame *first_frame = exe_ctx.GetFramePtr(); @@ -211,7 +212,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64( SymbolContext first_frame_sc( first_frame->GetSymbolContext(resolve_scope)); - const AddressRange *addr_range_ptr = NULL; + const AddressRange *addr_range_ptr = nullptr; AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); diff --git a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h index 9ee0b08ca09a..2208bcc2f2e4 100644 --- a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h +++ b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h @@ -1,9 +1,8 @@ //===-- UnwindMacOSXFrameBackchain.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -47,9 +46,7 @@ private: size_t GetStackFrameData_x86_64(const lldb_private::ExecutionContext &exe_ctx); - //------------------------------------------------------------------ // For UnwindMacOSXFrameBackchain only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(UnwindMacOSXFrameBackchain); }; diff --git a/source/Plugins/Process/Utility/lldb-arm-register-enums.h b/source/Plugins/Process/Utility/lldb-arm-register-enums.h index 49473bb885f2..39cbf01ea9d2 100644 --- a/source/Plugins/Process/Utility/lldb-arm-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-arm-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-arm-register-enums.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all ARM registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_arm = 0, gpr_r0_arm = k_first_gpr_arm, diff --git a/source/Plugins/Process/Utility/lldb-arm64-register-enums.h b/source/Plugins/Process/Utility/lldb-arm64-register-enums.h index 7181ce448195..cc414dcde3cf 100644 --- a/source/Plugins/Process/Utility/lldb-arm64-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-arm64-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-arm64-register-enums.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all ARM64 registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_arm64, gpr_x0_arm64 = k_first_gpr_arm64, diff --git a/source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h b/source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h index 61929365b736..d97f77122426 100644 --- a/source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-mips-freebsd-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-mips-freebsd-register-enums.h ----------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all mips registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_mips64, gpr_zero_mips64 = k_first_gpr_mips64, diff --git a/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h b/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h index 0ecf3e366db0..2f68b8022c9a 100644 --- a/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-mips-linux-register-enums.h @@ -1,10 +1,9 @@ //===-- lldb-mips-linux-register-enums.h -------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -14,9 +13,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all mips registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_mips, gpr_zero_mips = k_first_gpr_mips, @@ -149,9 +146,7 @@ enum { k_num_msa_registers_mips }; -//--------------------------------------------------------------------------- // Internal codes for all mips64 registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_mips64, gpr_zero_mips64 = k_first_gpr_mips64, diff --git a/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h b/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h index 9ea81c00b666..6edf7ee3864d 100644 --- a/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-ppc64-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-ppc64-register-enums.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -12,9 +11,7 @@ // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -// --------------------------------------------------------------------------- // Internal codes for all ppc64 registers. -// --------------------------------------------------------------------------- enum { k_first_gpr_ppc64, gpr_r0_ppc64 = k_first_gpr_ppc64, diff --git a/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h b/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h index 675804d13268..0c381a5f3918 100644 --- a/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-ppc64le-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-ppc64le-register-enums.h ---------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -12,9 +11,7 @@ // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -// --------------------------------------------------------------------------- // Internal codes for all ppc64le registers. -// --------------------------------------------------------------------------- enum { k_first_gpr_ppc64le, gpr_r0_ppc64le = k_first_gpr_ppc64le, diff --git a/source/Plugins/Process/Utility/lldb-s390x-register-enums.h b/source/Plugins/Process/Utility/lldb-s390x-register-enums.h index 65ff92f39bca..bd6626108290 100644 --- a/source/Plugins/Process/Utility/lldb-s390x-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-s390x-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-s390x-register-enums.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all s390x registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_s390x, lldb_r0_s390x = k_first_gpr_s390x, diff --git a/source/Plugins/Process/Utility/lldb-x86-register-enums.h b/source/Plugins/Process/Utility/lldb-x86-register-enums.h index 770ec5a5f3ef..0d2149c83573 100644 --- a/source/Plugins/Process/Utility/lldb-x86-register-enums.h +++ b/source/Plugins/Process/Utility/lldb-x86-register-enums.h @@ -1,9 +1,8 @@ //===-- lldb-x86-register-enums.h -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -13,9 +12,7 @@ namespace lldb_private { // LLDB register codes (e.g. RegisterKind == eRegisterKindLLDB) -//--------------------------------------------------------------------------- // Internal codes for all i386 registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_i386, lldb_eax_i386 = k_first_gpr_i386, @@ -136,9 +133,7 @@ enum { k_num_mpx_registers_i386, }; -//--------------------------------------------------------------------------- // Internal codes for all x86_64 registers. -//--------------------------------------------------------------------------- enum { k_first_gpr_x86_64, lldb_rax_x86_64 = k_first_gpr_x86_64, |