[lldb] Fix compilation with gcc-6.5
This fixes (works around) two errors with gcc-6.5. - in the RegisterContext_x86 files, gcc is unable to synthesize a default constructor -- it thinks it needs to initialize the virtual base class, even though said classes are abstract. I fix that by providing a dummy constructor. - In ReproducerInstrumentationTest, it is not able to deduce that the TestingRegistry class is movable (it contains a map of unique pointers). I change the type from Optional<TestingRegistry> to unique_ptr<TestingRegistry), so that moving is not required (copying/moving a polymorphic type is not a very good idea in any case).
This commit is contained in:
@@ -58,6 +58,12 @@ public:
|
||||
virtual llvm::Optional<MmapData> GetMmapData() { return llvm::None; }
|
||||
|
||||
protected:
|
||||
// NB: This constructor is here only because gcc<=6.5 requires a virtual base
|
||||
// class initializer on abstract class (even though it is never used). It can
|
||||
// be deleted once we move to gcc>=7.0.
|
||||
NativeRegisterContextLinux(NativeThreadProtocol &thread)
|
||||
: NativeRegisterContextRegisterInfo(thread, nullptr) {}
|
||||
|
||||
lldb::ByteOrder GetByteOrder() const;
|
||||
|
||||
virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value);
|
||||
|
||||
@@ -292,6 +292,8 @@ NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
|
||||
const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
|
||||
: NativeRegisterContextRegisterInfo(
|
||||
native_thread, CreateRegisterInfoInterface(target_arch)),
|
||||
NativeRegisterContextLinux(native_thread),
|
||||
NativeRegisterContextDBReg_x86(native_thread),
|
||||
m_xstate_type(XStateType::Invalid), m_ymm_set(), m_mpx_set(),
|
||||
m_reg_info(), m_gpr_x86_64() {
|
||||
// Set up data about ranges of valid registers.
|
||||
|
||||
@@ -16,6 +16,12 @@ namespace lldb_private {
|
||||
class NativeRegisterContextDBReg_x86
|
||||
: public virtual NativeRegisterContextRegisterInfo {
|
||||
public:
|
||||
// NB: This constructor is here only because gcc<=6.5 requires a virtual base
|
||||
// class initializer on abstract class (even though it is never used). It can
|
||||
// be deleted once we move to gcc>=7.0.
|
||||
NativeRegisterContextDBReg_x86(NativeThreadProtocol &thread)
|
||||
: NativeRegisterContextRegisterInfo(thread, nullptr) {}
|
||||
|
||||
Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
|
||||
|
||||
Status GetWatchpointHitIndex(uint32_t &wp_index,
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
TestingRegistry();
|
||||
};
|
||||
|
||||
static llvm::Optional<TestingRegistry> g_registry;
|
||||
static std::unique_ptr<TestingRegistry> g_registry;
|
||||
static llvm::Optional<Serializer> g_serializer;
|
||||
static llvm::Optional<Deserializer> g_deserializer;
|
||||
|
||||
@@ -75,13 +75,13 @@ inline TestInstrumentationData GetTestInstrumentationData() {
|
||||
class TestInstrumentationDataRAII {
|
||||
public:
|
||||
TestInstrumentationDataRAII(llvm::raw_string_ostream &os) {
|
||||
g_registry.emplace();
|
||||
g_registry = std::make_unique<TestingRegistry>();
|
||||
g_serializer.emplace(os);
|
||||
g_deserializer.reset();
|
||||
}
|
||||
|
||||
TestInstrumentationDataRAII(llvm::StringRef buffer) {
|
||||
g_registry.emplace();
|
||||
g_registry = std::make_unique<TestingRegistry>();
|
||||
g_serializer.reset();
|
||||
g_deserializer.emplace(buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user