[Lldb-commits] [lldb] r298466 - Break the cycle between Host and PluginProcessUtility.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 21 17:27:55 PDT 2017
Author: zturner
Date: Tue Mar 21 19:27:54 2017
New Revision: 298466
URL: http://llvm.org/viewvc/llvm-project?rev=298466&view=rev
Log:
Break the cycle between Host and PluginProcessUtility.
There are only two users of NativeRegisterContextRegisterInfo,
and both are in process plugins. Moving this code from Host
to Plugins/Process/Utility thus makes sense, and as it is the
only dependency from Host -> PluginProcessUtility, it also
breaks this cycle, reducing LLDB's overall cycle count from
45 to 44.
Added:
lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
Removed:
lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp
Modified:
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
Removed: lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h?rev=298465&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h (removed)
@@ -1,42 +0,0 @@
-//===-- NativeRegisterContextRegisterInfo.h ----------------------*- C++
-//-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_NativeRegisterContextRegisterInfo_h
-#define lldb_NativeRegisterContextRegisterInfo_h
-
-#include <memory>
-
-#include "NativeRegisterContext.h"
-#include "Plugins/Process/Utility/RegisterInfoInterface.h"
-
-namespace lldb_private {
-class NativeRegisterContextRegisterInfo : public NativeRegisterContext {
-public:
- ///
- /// Construct a NativeRegisterContextRegisterInfo, taking ownership
- /// of the register_info_interface pointer.
- ///
- NativeRegisterContextRegisterInfo(
- NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info_interface);
-
- uint32_t GetRegisterCount() const override;
-
- uint32_t GetUserRegisterCount() const override;
-
- const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const override;
-
- const RegisterInfoInterface &GetRegisterInfoInterface() const;
-
-private:
- std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up;
-};
-}
-#endif
Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=298466&r1=298465&r2=298466&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Mar 21 19:27:54 2017
@@ -22,7 +22,6 @@ add_host_subdirectory(common
common/NativeWatchpointList.cpp
common/NativeProcessProtocol.cpp
common/NativeRegisterContext.cpp
- common/NativeRegisterContextRegisterInfo.cpp
common/NativeThreadProtocol.cpp
common/OptionParser.cpp
common/PipeBase.cpp
Removed: lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp?rev=298465&view=auto
==============================================================================
--- lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp (original)
+++ lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp (removed)
@@ -1,43 +0,0 @@
-//===-- NativeRegisterContextRegisterInfo.cpp -------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
-#include "lldb/lldb-private-forward.h"
-#include "lldb/lldb-types.h"
-
-using namespace lldb_private;
-
-NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo(
- NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info_interface)
- : NativeRegisterContext(thread, concrete_frame_idx),
- m_register_info_interface_up(register_info_interface) {
- assert(register_info_interface && "null register_info_interface");
-}
-
-uint32_t NativeRegisterContextRegisterInfo::GetRegisterCount() const {
- return m_register_info_interface_up->GetRegisterCount();
-}
-
-uint32_t NativeRegisterContextRegisterInfo::GetUserRegisterCount() const {
- return m_register_info_interface_up->GetUserRegisterCount();
-}
-
-const RegisterInfo *NativeRegisterContextRegisterInfo::GetRegisterInfoAtIndex(
- uint32_t reg_index) const {
- if (reg_index <= GetRegisterCount())
- return m_register_info_interface_up->GetRegisterInfo() + reg_index;
- else
- return nullptr;
-}
-
-const RegisterInfoInterface &
-NativeRegisterContextRegisterInfo::GetRegisterInfoInterface() const {
- return *m_register_info_interface_up;
-}
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h?rev=298466&r1=298465&r2=298466&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h Tue Mar 21 19:27:54 2017
@@ -10,10 +10,10 @@
#ifndef lldb_NativeRegisterContextLinux_h
#define lldb_NativeRegisterContextLinux_h
-#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "Plugins/Process/Linux/NativeProcessLinux.h"
+#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
namespace lldb_private {
namespace process_linux {
Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h?rev=298466&r1=298465&r2=298466&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h (original)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h Tue Mar 21 19:27:54 2017
@@ -10,10 +10,10 @@
#ifndef lldb_NativeRegisterContextNetBSD_h
#define lldb_NativeRegisterContextNetBSD_h
-#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
#include "lldb/Host/common/NativeThreadProtocol.h"
#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
+#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
namespace lldb_private {
namespace process_netbsd {
Modified: lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt?rev=298466&r1=298465&r2=298466&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt Tue Mar 21 19:27:54 2017
@@ -9,6 +9,7 @@ add_lldb_library(lldbPluginProcessUtilit
InferiorCallPOSIX.cpp
LinuxSignals.cpp
MipsLinuxSignals.cpp
+ NativeRegisterContextRegisterInfo.cpp
NetBSDSignals.cpp
RegisterContextDarwin_arm.cpp
RegisterContextDarwin_arm64.cpp
Added: lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp?rev=298466&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp (added)
+++ lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp Tue Mar 21 19:27:54 2017
@@ -0,0 +1,43 @@
+//===-- NativeRegisterContextRegisterInfo.cpp -------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "NativeRegisterContextRegisterInfo.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-types.h"
+
+using namespace lldb_private;
+
+NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo(
+ NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
+ RegisterInfoInterface *register_info_interface)
+ : NativeRegisterContext(thread, concrete_frame_idx),
+ m_register_info_interface_up(register_info_interface) {
+ assert(register_info_interface && "null register_info_interface");
+}
+
+uint32_t NativeRegisterContextRegisterInfo::GetRegisterCount() const {
+ return m_register_info_interface_up->GetRegisterCount();
+}
+
+uint32_t NativeRegisterContextRegisterInfo::GetUserRegisterCount() const {
+ return m_register_info_interface_up->GetUserRegisterCount();
+}
+
+const RegisterInfo *NativeRegisterContextRegisterInfo::GetRegisterInfoAtIndex(
+ uint32_t reg_index) const {
+ if (reg_index <= GetRegisterCount())
+ return m_register_info_interface_up->GetRegisterInfo() + reg_index;
+ else
+ return nullptr;
+}
+
+const RegisterInfoInterface &
+NativeRegisterContextRegisterInfo::GetRegisterInfoInterface() const {
+ return *m_register_info_interface_up;
+}
Added: lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h?rev=298466&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h (added)
+++ lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h Tue Mar 21 19:27:54 2017
@@ -0,0 +1,41 @@
+//===-- NativeRegisterContextRegisterInfo.h ---------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_PLUGINS_PROCESS_UTIILTY_NATIVE_REGISTER_CONTEXT_REGISTER_INFO
+#define LLDB_PLUGINS_PROCESS_UTIILTY_NATIVE_REGISTER_CONTEXT_REGISTER_INFO
+
+#include <memory>
+
+#include "RegisterInfoInterface.h"
+#include "lldb/Host/common/NativeRegisterContext.h"
+
+namespace lldb_private {
+class NativeRegisterContextRegisterInfo : public NativeRegisterContext {
+public:
+ ///
+ /// Construct a NativeRegisterContextRegisterInfo, taking ownership
+ /// of the register_info_interface pointer.
+ ///
+ NativeRegisterContextRegisterInfo(
+ NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
+ RegisterInfoInterface *register_info_interface);
+
+ uint32_t GetRegisterCount() const override;
+
+ uint32_t GetUserRegisterCount() const override;
+
+ const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const override;
+
+ const RegisterInfoInterface &GetRegisterInfoInterface() const;
+
+private:
+ std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up;
+};
+}
+#endif
More information about the lldb-commits
mailing list