[Lldb-commits] [PATCH] D121443: [lldb] Add a getter for the process' system architecture

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 10 23:00:07 PST 2022


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121443.414586.patch
Type: text/x-patch
Size: 2042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220311/624ad480/attachment.bin>


More information about the lldb-commits mailing list