forked from OSchip/llvm-project
Fix Clang-tidy modernize-use-override warnings in include/lldb/Disassembler and OperatingSystem; other minor fixes.
Second attempt which should work for MSVC. llvm-svn: 251066
This commit is contained in:
parent
e2dd2fd7c7
commit
45a4014a50
|
@ -7,8 +7,9 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "DisassemblerLLVMC.h"
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Project includes
|
||||
#include "llvm-c/Disassembler.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
|
@ -25,6 +26,8 @@
|
|||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "DisassemblerLLVMC.h"
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/DataExtractor.h"
|
||||
|
@ -58,13 +61,10 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~InstructionLLVMC ()
|
||||
{
|
||||
}
|
||||
~InstructionLLVMC() override = default;
|
||||
|
||||
virtual bool
|
||||
DoesBranch ()
|
||||
bool
|
||||
DoesBranch() override
|
||||
{
|
||||
if (m_does_branch == eLazyBoolCalculate)
|
||||
{
|
||||
|
@ -100,8 +100,8 @@ public:
|
|||
return m_does_branch == eLazyBoolYes;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
HasDelaySlot ()
|
||||
bool
|
||||
HasDelaySlot() override
|
||||
{
|
||||
if (m_has_delay_slot == eLazyBoolCalculate)
|
||||
{
|
||||
|
@ -155,10 +155,10 @@ public:
|
|||
return llvm_disasm.m_disasm_ap.get();
|
||||
}
|
||||
|
||||
virtual size_t
|
||||
size_t
|
||||
Decode(const lldb_private::Disassembler &disassembler,
|
||||
const lldb_private::DataExtractor &data,
|
||||
lldb::offset_t data_offset)
|
||||
lldb::offset_t data_offset) override
|
||||
{
|
||||
// All we have to do is read the opcode which can be easy for some
|
||||
// architectures
|
||||
|
@ -272,8 +272,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void
|
||||
CalculateMnemonicOperandsAndComment (const lldb_private::ExecutionContext *exe_ctx)
|
||||
void
|
||||
CalculateMnemonicOperandsAndComment(const lldb_private::ExecutionContext *exe_ctx) override
|
||||
{
|
||||
DataExtractor data;
|
||||
const AddressClass address_class = GetAddressClass ();
|
||||
|
@ -452,8 +452,6 @@ protected:
|
|||
bool m_using_file_addr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, const char *cpu, const char *features_str, unsigned flavor, DisassemblerLLVMC &owner):
|
||||
m_is_valid(true)
|
||||
{
|
||||
|
@ -521,9 +519,7 @@ DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, con
|
|||
m_is_valid = false;
|
||||
}
|
||||
|
||||
DisassemblerLLVMC::LLVMCDisassembler::~LLVMCDisassembler()
|
||||
{
|
||||
}
|
||||
DisassemblerLLVMC::LLVMCDisassembler::~LLVMCDisassembler() = default;
|
||||
|
||||
uint64_t
|
||||
DisassemblerLLVMC::LLVMCDisassembler::GetMCInst (const uint8_t *opcode_data,
|
||||
|
@ -587,38 +583,6 @@ DisassemblerLLVMC::LLVMCDisassembler::HasDelaySlot (llvm::MCInst &mc_inst)
|
|||
return m_instr_info_ap->get(mc_inst.getOpcode()).hasDelaySlot();
|
||||
}
|
||||
|
||||
bool
|
||||
DisassemblerLLVMC::FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor)
|
||||
{
|
||||
llvm::Triple triple = arch.GetTriple();
|
||||
if (flavor == NULL || strcmp (flavor, "default") == 0)
|
||||
return true;
|
||||
|
||||
if (triple.getArch() == llvm::Triple::x86 || triple.getArch() == llvm::Triple::x86_64)
|
||||
{
|
||||
if (strcmp (flavor, "intel") == 0 || strcmp (flavor, "att") == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Disassembler *
|
||||
DisassemblerLLVMC::CreateInstance (const ArchSpec &arch, const char *flavor)
|
||||
{
|
||||
if (arch.GetTriple().getArch() != llvm::Triple::UnknownArch)
|
||||
{
|
||||
std::unique_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch, flavor));
|
||||
|
||||
if (disasm_ap.get() && disasm_ap->IsValid())
|
||||
return disasm_ap.release();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DisassemblerLLVMC::DisassemblerLLVMC (const ArchSpec &arch, const char *flavor_string) :
|
||||
Disassembler(arch, flavor_string),
|
||||
m_exe_ctx (NULL),
|
||||
|
@ -782,8 +746,19 @@ DisassemblerLLVMC::DisassemblerLLVMC (const ArchSpec &arch, const char *flavor_s
|
|||
}
|
||||
}
|
||||
|
||||
DisassemblerLLVMC::~DisassemblerLLVMC()
|
||||
DisassemblerLLVMC::~DisassemblerLLVMC() = default;
|
||||
|
||||
Disassembler *
|
||||
DisassemblerLLVMC::CreateInstance (const ArchSpec &arch, const char *flavor)
|
||||
{
|
||||
if (arch.GetTriple().getArch() != llvm::Triple::UnknownArch)
|
||||
{
|
||||
std::unique_ptr<DisassemblerLLVMC> disasm_ap (new DisassemblerLLVMC(arch, flavor));
|
||||
|
||||
if (disasm_ap.get() && disasm_ap->IsValid())
|
||||
return disasm_ap.release();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -888,6 +863,24 @@ const char *DisassemblerLLVMC::SymbolLookupCallback (void *disassembler,
|
|||
name);
|
||||
}
|
||||
|
||||
bool
|
||||
DisassemblerLLVMC::FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor)
|
||||
{
|
||||
llvm::Triple triple = arch.GetTriple();
|
||||
if (flavor == NULL || strcmp (flavor, "default") == 0)
|
||||
return true;
|
||||
|
||||
if (triple.getArch() == llvm::Triple::x86 || triple.getArch() == llvm::Triple::x86_64)
|
||||
{
|
||||
if (strcmp (flavor, "intel") == 0 || strcmp (flavor, "att") == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int DisassemblerLLVMC::OpInfo (uint64_t PC,
|
||||
uint64_t Offset,
|
||||
uint64_t Size,
|
||||
|
|
|
@ -10,10 +10,20 @@
|
|||
#ifndef liblldb_DisassemblerLLVMC_h_
|
||||
#define liblldb_DisassemblerLLVMC_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm-c/Disassembler.h"
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/Disassembler.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
// Opaque references to C++ Objects in LLVM's MC.
|
||||
namespace llvm
|
||||
{
|
||||
|
@ -25,12 +35,7 @@ namespace llvm
|
|||
class MCInstPrinter;
|
||||
class MCAsmInfo;
|
||||
class MCSubtargetInfo;
|
||||
}
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/Disassembler.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
} // namespace llvm
|
||||
|
||||
class InstructionLLVMC;
|
||||
|
||||
|
@ -67,6 +72,10 @@ class DisassemblerLLVMC : public lldb_private::Disassembler
|
|||
};
|
||||
|
||||
public:
|
||||
DisassemblerLLVMC(const lldb_private::ArchSpec &arch, const char *flavor /* = NULL */);
|
||||
|
||||
~DisassemblerLLVMC() override;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Static Functions
|
||||
//------------------------------------------------------------------
|
||||
|
@ -82,33 +91,28 @@ public:
|
|||
static lldb_private::Disassembler *
|
||||
CreateInstance(const lldb_private::ArchSpec &arch, const char *flavor);
|
||||
|
||||
DisassemblerLLVMC(const lldb_private::ArchSpec &arch, const char *flavor /* = NULL */);
|
||||
|
||||
virtual
|
||||
~DisassemblerLLVMC();
|
||||
|
||||
virtual size_t
|
||||
size_t
|
||||
DecodeInstructions(const lldb_private::Address &base_addr,
|
||||
const lldb_private::DataExtractor& data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t num_instructions,
|
||||
bool append,
|
||||
bool data_from_file);
|
||||
bool data_from_file) override;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb_private::ConstString
|
||||
GetPluginName();
|
||||
lldb_private::ConstString
|
||||
GetPluginName() override;
|
||||
|
||||
virtual uint32_t
|
||||
GetPluginVersion();
|
||||
uint32_t
|
||||
GetPluginVersion() override;
|
||||
|
||||
protected:
|
||||
friend class InstructionLLVMC;
|
||||
|
||||
virtual bool
|
||||
FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor);
|
||||
bool
|
||||
FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor) override;
|
||||
|
||||
bool
|
||||
IsValid()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===-- OperatingSystemGo.cpp --------------------------------*- C++ -*-===//
|
||||
//===-- OperatingSystemGo.cpp -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -6,13 +6,15 @@
|
|||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "OperatingSystemGo.h"
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <unordered_map>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "OperatingSystemGo.h"
|
||||
|
||||
#include "lldb/Core/DataBufferHeap.h"
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
|
@ -57,12 +59,6 @@ enum
|
|||
class PluginProperties : public Properties
|
||||
{
|
||||
public:
|
||||
static ConstString
|
||||
GetSettingName()
|
||||
{
|
||||
return OperatingSystemGo::GetPluginNameStatic();
|
||||
}
|
||||
|
||||
PluginProperties()
|
||||
: Properties()
|
||||
{
|
||||
|
@ -70,7 +66,13 @@ class PluginProperties : public Properties
|
|||
m_collection_sp->Initialize(g_properties);
|
||||
}
|
||||
|
||||
virtual ~PluginProperties() {}
|
||||
~PluginProperties() override = default;
|
||||
|
||||
static ConstString
|
||||
GetSettingName()
|
||||
{
|
||||
return OperatingSystemGo::GetPluginNameStatic();
|
||||
}
|
||||
|
||||
bool
|
||||
GetEnableGoroutines()
|
||||
|
@ -101,9 +103,6 @@ GetGlobalPluginProperties()
|
|||
class RegisterContextGo : public RegisterContextMemory
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
RegisterContextGo(lldb_private::Thread &thread, uint32_t concrete_frame_idx, DynamicRegisterInfo ®_info,
|
||||
lldb::addr_t reg_data_addr)
|
||||
: RegisterContextMemory(thread, concrete_frame_idx, reg_info, reg_data_addr)
|
||||
|
@ -118,10 +117,11 @@ class RegisterContextGo : public RegisterContextMemory
|
|||
m_reg_data.SetData(reg_data_sp);
|
||||
}
|
||||
|
||||
virtual ~RegisterContextGo() {}
|
||||
~RegisterContextGo() override = default;
|
||||
|
||||
virtual bool
|
||||
ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue ®_value)
|
||||
bool
|
||||
ReadRegister(const lldb_private::RegisterInfo *reg_info,
|
||||
lldb_private::RegisterValue ®_value) override
|
||||
{
|
||||
switch (reg_info->kinds[eRegisterKindGeneric])
|
||||
{
|
||||
|
@ -134,8 +134,9 @@ class RegisterContextGo : public RegisterContextMemory
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool
|
||||
WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue ®_value)
|
||||
bool
|
||||
WriteRegister(const lldb_private::RegisterInfo *reg_info,
|
||||
const lldb_private::RegisterValue ®_value) override
|
||||
{
|
||||
switch (reg_info->kinds[eRegisterKindGeneric])
|
||||
{
|
||||
|
@ -151,7 +152,7 @@ class RegisterContextGo : public RegisterContextMemory
|
|||
DISALLOW_COPY_AND_ASSIGN(RegisterContextGo);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
|
||||
struct OperatingSystemGo::Goroutine
|
||||
{
|
||||
|
@ -219,6 +220,14 @@ OperatingSystemGo::CreateInstance(Process *process, bool force)
|
|||
return new OperatingSystemGo(process);
|
||||
}
|
||||
|
||||
OperatingSystemGo::OperatingSystemGo(lldb_private::Process *process)
|
||||
: OperatingSystem(process)
|
||||
, m_reginfo(new DynamicRegisterInfo)
|
||||
{
|
||||
}
|
||||
|
||||
OperatingSystemGo::~OperatingSystemGo() = default;
|
||||
|
||||
ConstString
|
||||
OperatingSystemGo::GetPluginNameStatic()
|
||||
{
|
||||
|
@ -232,16 +241,6 @@ OperatingSystemGo::GetPluginDescriptionStatic()
|
|||
return "Operating system plug-in that reads runtime data-structures for goroutines.";
|
||||
}
|
||||
|
||||
OperatingSystemGo::OperatingSystemGo(lldb_private::Process *process)
|
||||
: OperatingSystem(process)
|
||||
, m_reginfo(new DynamicRegisterInfo)
|
||||
{
|
||||
}
|
||||
|
||||
OperatingSystemGo::~OperatingSystemGo()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
OperatingSystemGo::Init(ThreadList &threads)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
//===-- OperatingSystemGo.h ----------------------------------*- C++ -*-===//
|
||||
//===-- OperatingSystemGo.h -------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===-------------------------------------------------------------------===//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _liblldb_OperatingSystemGo_h_
|
||||
#define _liblldb_OperatingSystemGo_h_
|
||||
|
||||
#include <iostream>
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Target/OperatingSystem.h"
|
||||
|
||||
class DynamicRegisterInfo;
|
||||
|
@ -19,6 +23,10 @@ class DynamicRegisterInfo;
|
|||
class OperatingSystemGo : public lldb_private::OperatingSystem
|
||||
{
|
||||
public:
|
||||
OperatingSystemGo(lldb_private::Process *process);
|
||||
|
||||
~OperatingSystemGo() override;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Static Functions
|
||||
//------------------------------------------------------------------
|
||||
|
@ -34,37 +42,31 @@ class OperatingSystemGo : public lldb_private::OperatingSystem
|
|||
|
||||
static const char *GetPluginDescriptionStatic();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Class Methods
|
||||
//------------------------------------------------------------------
|
||||
OperatingSystemGo(lldb_private::Process *process);
|
||||
|
||||
virtual ~OperatingSystemGo();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// lldb_private::PluginInterface Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb_private::ConstString GetPluginName();
|
||||
lldb_private::ConstString GetPluginName() override;
|
||||
|
||||
virtual uint32_t GetPluginVersion();
|
||||
uint32_t GetPluginVersion() override;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// lldb_private::OperatingSystem Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual bool UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &real_thread_list,
|
||||
lldb_private::ThreadList &new_thread_list);
|
||||
bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
|
||||
lldb_private::ThreadList &real_thread_list,
|
||||
lldb_private::ThreadList &new_thread_list) override;
|
||||
|
||||
virtual void ThreadWasSelected(lldb_private::Thread *thread);
|
||||
void ThreadWasSelected(lldb_private::Thread *thread) override;
|
||||
|
||||
virtual lldb::RegisterContextSP CreateRegisterContextForThread(lldb_private::Thread *thread,
|
||||
lldb::addr_t reg_data_addr);
|
||||
lldb::RegisterContextSP CreateRegisterContextForThread(lldb_private::Thread *thread,
|
||||
lldb::addr_t reg_data_addr) override;
|
||||
|
||||
virtual lldb::StopInfoSP CreateThreadStopReason(lldb_private::Thread *thread);
|
||||
lldb::StopInfoSP CreateThreadStopReason(lldb_private::Thread *thread) override;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Method for lazy creation of threads on demand
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context);
|
||||
lldb::ThreadSP CreateThread(lldb::tid_t tid, lldb::addr_t context) override;
|
||||
|
||||
private:
|
||||
struct Goroutine;
|
||||
|
@ -82,4 +84,4 @@ class OperatingSystemGo : public lldb_private::OperatingSystem
|
|||
lldb::ValueObjectSP m_allglen_sp;
|
||||
};
|
||||
|
||||
#endif // #ifndef liblldb_OperatingSystemGo_h_
|
||||
#endif // liblldb_OperatingSystemGo_h_
|
||||
|
|
Loading…
Reference in New Issue