[Lldb-commits] [lldb] 1dc3937 - [lldb/qemu] Stub out process info functions

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 28 00:18:20 PDT 2022


Author: Pavel Labath
Date: 2022-10-28T09:17:53+02:00
New Revision: 1dc39378c46643ec9d2544da671aca78e7c6967a

URL: https://github.com/llvm/llvm-project/commit/1dc39378c46643ec9d2544da671aca78e7c6967a
DIFF: https://github.com/llvm/llvm-project/commit/1dc39378c46643ec9d2544da671aca78e7c6967a.diff

LOG: [lldb/qemu] Stub out process info functions

These functions return the information about the host process (so they
show the executable as "qemu" and have the "wrong" architecture), which
isn't useful and can confuse lldb.

We could theoretically try to identify which host processes are running
an emulator, and translate the process information, but that would be
tricky to implement, and the usefulness of it would be fairly limited as
qemu does not support attaching to a running process.

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
    lldb/test/API/qemu/TestQemuAPI.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
index 0dd0e2f6f2b9b..a29b5bcdedc74 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
@@ -42,6 +42,16 @@ class PlatformQemuUser : public Platform {
     return nullptr;
   }
 
+  uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+                         ProcessInstanceInfoList &proc_infos) override {
+    return 0;
+  }
+
+  bool GetProcessInfo(lldb::pid_t pid,
+                      ProcessInstanceInfo &proc_info) override {
+    return false;
+  }
+
   bool IsConnected() const override { return true; }
 
   void CalculateTrapHandlerSymbolNames() override {}

diff  --git a/lldb/test/API/qemu/TestQemuAPI.py b/lldb/test/API/qemu/TestQemuAPI.py
index 05db64fc21837..6bca22d4c17f6 100644
--- a/lldb/test/API/qemu/TestQemuAPI.py
+++ b/lldb/test/API/qemu/TestQemuAPI.py
@@ -23,3 +23,9 @@ def test_file_api(self):
         self.assertSuccess(qemu.MakeDirectory(
             self.getBuildArtifact("target_dir")))
         self.assertTrue(os.path.isdir(self.getBuildArtifact("target_dir")))
+
+    def test_process_api(self):
+        self.dbg.SetCurrentPlatform("qemu-user")
+        self.expect("platform process list",
+                substrs=['no processes were found on the "qemu-user" platform'],
+                error=True)


        


More information about the lldb-commits mailing list