JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, labath, jingham.
Herald added a project: All.
JDevlieghere requested review of this revision.

This patch adds a getter for the process' system architecture. I went with 
`Process::GetSystemArchitecture` to match `Platform::GetSystemArchitecture`.


https://reviews.llvm.org/D121443

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Target/Process.cpp


Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -2650,6 +2650,10 @@
   return *m_jit_loaders_up;
 }
 
+ArchSpec Process::GetSystemArchitecture() {
+  return HostInfo::GetArchitecture();
+}
+
 SystemRuntime *Process::GetSystemRuntime() {
   if (!m_system_runtime_up)
     m_system_runtime_up.reset(SystemRuntime::FindPlugin(this));
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -70,6 +70,8 @@
 
   static std::chrono::seconds GetPacketTimeout();
 
+  ArchSpec GetSystemArchitecture() override;
+
   // Check if a given Process
   bool CanDebug(lldb::TargetSP target_sp,
                 bool plugin_specified_by_name) override;
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -208,6 +208,10 @@
   return std::chrono::seconds(GetGlobalPluginProperties().GetPacketTimeout());
 }
 
+ArchSpec ProcessGDBRemote::GetSystemArchitecture() {
+  return m_gdb_comm.GetHostArchitecture();
+}
+
 bool ProcessGDBRemote::CanDebug(lldb::TargetSP target_sp,
                                 bool plugin_specified_by_name) {
   if (plugin_specified_by_name)
Index: lldb/include/lldb/Target/Process.h
===================================================================
--- lldb/include/lldb/Target/Process.h
+++ lldb/include/lldb/Target/Process.h
@@ -696,6 +696,9 @@
   virtual JITLoaderList &GetJITLoaders();
 
 public:
+  /// Get the system architecture for this process.
+  virtual ArchSpec GetSystemArchitecture();
+
   /// Get the system runtime plug-in for this process.
   ///
   /// \return


Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -2650,6 +2650,10 @@
   return *m_jit_loaders_up;
 }
 
+ArchSpec Process::GetSystemArchitecture() {
+  return HostInfo::GetArchitecture();
+}
+
 SystemRuntime *Process::GetSystemRuntime() {
   if (!m_system_runtime_up)
     m_system_runtime_up.reset(SystemRuntime::FindPlugin(this));
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -70,6 +70,8 @@
 
   static std::chrono::seconds GetPacketTimeout();
 
+  ArchSpec GetSystemArchitecture() override;
+
   // Check if a given Process
   bool CanDebug(lldb::TargetSP target_sp,
                 bool plugin_specified_by_name) override;
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -208,6 +208,10 @@
   return std::chrono::seconds(GetGlobalPluginProperties().GetPacketTimeout());
 }
 
+ArchSpec ProcessGDBRemote::GetSystemArchitecture() {
+  return m_gdb_comm.GetHostArchitecture();
+}
+
 bool ProcessGDBRemote::CanDebug(lldb::TargetSP target_sp,
                                 bool plugin_specified_by_name) {
   if (plugin_specified_by_name)
Index: lldb/include/lldb/Target/Process.h
===================================================================
--- lldb/include/lldb/Target/Process.h
+++ lldb/include/lldb/Target/Process.h
@@ -696,6 +696,9 @@
   virtual JITLoaderList &GetJITLoaders();
 
 public:
+  /// Get the system architecture for this process.
+  virtual ArchSpec GetSystemArchitecture();
+
   /// Get the system runtime plug-in for this process.
   ///
   /// \return
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to