[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 5 22:59:03 PDT 2024


================
@@ -6,20 +6,27 @@
 
 class MyScriptedPlatform(ScriptedPlatform):
     def __init__(self, exe_ctx, args):
-        self.processes = {}
-
-        proc = {}
-        proc["name"] = "a.out"
-        proc["arch"] = "arm64-apple-macosx"
-        proc["pid"] = 420
-        proc["parent"] = 42
-        proc["uid"] = 501
-        proc["gid"] = 20
-        self.processes[420] = proc
+        super.__init__(exe_ctx, args)
+
+        if args and args.GetType() == lldb.eStructuredDataTypeDictionary:
+            processes = args.GetValueForKey("processes")
+            for i in range(0, processes.GetSize()):
+                proc_info = processes.GetItemAtIndex(i)
+                proc = {}
+                proc["name"] = proc_info.GetValueForKey("name").GetStringValue(42)
+                proc["arch"] = proc_info.GetValueForKey("arch").GetStringValue(42)
+                proc["pid"] = proc_info.GetValueForKey("pid").GetIntegerValue()
+                proc["parent"] = proc_info.GetValueForKey("parent").GetIntegerValue()
+                proc["uid"] = proc_info.GetValueForKey("uid").GetIntegerValue()
+                proc["gid"] = proc_info.GetValueForKey("gid").GetIntegerValue()
----------------
clayborg wrote:

Can we document this dictionary format somewhere that users can see this and specify which ones are mandatory and which are optional?

https://github.com/llvm/llvm-project/pull/99814


More information about the lldb-commits mailing list