add_lldb_library(lldbPluginProcessOpenBSD PLUGIN
NativeProcessOpenBSD.cpp
NativeRegisterContextOpenBSD.cpp
- NativeRegisterContextOpenBSD_x86_64.cpp
- NativeRegisterContextOpenBSD_arm64.cpp
+ NativeRegisterContextOpenBSD_arch.cpp
NativeThreadOpenBSD.cpp
LINK_LIBS
// NativeRegisterContextOpenBSD. The implementations can't collide as only one
// NativeRegisterContextOpenBSD_* variant should be compiled into the final
// executable.
- static NativeRegisterContextOpenBSD *
+ static std::unique_ptr<NativeRegisterContextOpenBSD>
CreateHostNativeRegisterContextOpenBSD(const ArchSpec &target_arch,
NativeThreadProtocol &native_thread);
--- /dev/null
+//===-- NativeRegisterContextOpenBSD_arch.cpp ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// NativeRegisterContextOpenBSD_* contains the implementations for each
+// supported architecture, and includes the static initalizer
+// CreateHostNativeRegisterContextOpenBSD() implementation which returns a arch
+// specific register context. In order to facilitate compiling lldb
+// on architectures which do not have an RegisterContext implementation
+// this file will include the relevant backend, and otherwise will
+// include a stub implentation which just reports an error and exits.
+
+#if defined(__arm64__) || defined(__aarch64__)
+#include "NativeRegisterContextOpenBSD_arm64.cpp"
+#elif defined(__x86_64__)
+#include "NativeRegisterContextOpenBSD_x86_64.cpp"
+#else
+
+#include "Plugins/Process/OpenBSD/NativeRegisterContextOpenBSD.h"
+
+using namespace lldb_private;
+using namespace lldb_private::process_openbsd;
+
+std::unique_ptr<NativeRegisterContextOpenBSD>
+NativeRegisterContextOpenBSD::CreateHostNativeRegisterContextOpenBSD(
+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
+ return std::unique_ptr<NativeRegisterContextOpenBSD>{};
+}
+
+#endif
//
//===----------------------------------------------------------------------===//
-#if defined(__arm64__) || defined(__aarch64__)
-
#include <elf.h>
#include <err.h>
#include <stdint.h>
{"Floating Point Registers", "fpu", k_num_fpr_registers_arm64,
g_fpu_regnums_arm64}};
-NativeRegisterContextOpenBSD *
+std::unique_ptr<NativeRegisterContextOpenBSD>
NativeRegisterContextOpenBSD::CreateHostNativeRegisterContextOpenBSD(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
- return new NativeRegisterContextOpenBSD_arm64(target_arch, native_thread);
+ return std::make_unique<NativeRegisterContextOpenBSD_arm64>(target_arch, native_thread);
}
// ----------------------------------------------------------------------------
}
return -1;
}
-
-#endif // defined(__arm64__) || defined(__aarch64__)
//
//===----------------------------------------------------------------------===//
-#if defined(__arm64__) || defined(__aarch64__)
-
#ifndef lldb_NativeRegisterContextOpenBSD_arm64_h
#define lldb_NativeRegisterContextOpenBSD_arm64_h
} // namespace lldb_private
#endif // #ifndef lldb_NativeRegisterContextOpenBSD_arm64_h
-
-#endif // defined(__arm64__) || defined(__aarch64__)
//
//===----------------------------------------------------------------------===//
-#if defined(__x86_64__)
-
#include <elf.h>
#include <err.h>
#include <stdint.h>
#define REG_CONTEXT_SIZE (GetGPRSize() + GetFPRSize())
-NativeRegisterContextOpenBSD *
+std::unique_ptr<NativeRegisterContextOpenBSD>
NativeRegisterContextOpenBSD::CreateHostNativeRegisterContextOpenBSD(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread) {
- return new NativeRegisterContextOpenBSD_x86_64(target_arch, native_thread);
+ return std::make_unique<NativeRegisterContextOpenBSD_x86_64>(target_arch, native_thread);
}
// ----------------------------------------------------------------------------
return error;
}
-
-#endif // defined(__x86_64__)
//
//===----------------------------------------------------------------------===//
-#if defined(__x86_64__)
-
#ifndef lldb_NativeRegisterContextOpenBSD_x86_64_h
#define lldb_NativeRegisterContextOpenBSD_x86_64_h
} // namespace lldb_private
#endif // #ifndef lldb_NativeRegisterContextOpenBSD_x86_64_h
-
-#endif // defined(__x86_64__)
NativeThreadOpenBSD::NativeThreadOpenBSD(NativeProcessOpenBSD &process,
lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
- m_stop_info(), m_reg_context_up(
-NativeRegisterContextOpenBSD::CreateHostNativeRegisterContextOpenBSD(process.GetArchitecture(), *this)
-), m_stop_description() {}
+ m_stop_info(), m_stop_description() {
+ m_reg_context_up = NativeRegisterContextOpenBSD::CreateHostNativeRegisterContextOpenBSD(process.GetArchitecture(), *this);
+ if (!m_reg_context_up)
+ llvm_unreachable("This architecture does not support debugging running processes.");
+}
void NativeThreadOpenBSD::SetStoppedBySignal(uint32_t signo,
const siginfo_t *info) {
-# $OpenBSD: Makefile,v 1.7 2020/08/03 14:45:30 patrick Exp $
+# $OpenBSD: Makefile,v 1.8 2021/02/14 16:16:02 mortimer Exp $
LIB= lldbPluginProcess
NOPIC=
MipsLinuxSignals.cpp \
NativeProcessOpenBSD.cpp \
NativeRegisterContextOpenBSD.cpp \
- NativeRegisterContextOpenBSD_x86_64.cpp \
- NativeRegisterContextOpenBSD_arm64.cpp \
+ NativeRegisterContextOpenBSD_arch.cpp \
NativeRegisterContextRegisterInfo.cpp \
NativeThreadOpenBSD.cpp \
NetBSDSignals.cpp \