[Lldb-commits] [PATCH] D60968: WIP, RFC: Add an example of how LLDB python plug-in could look like

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 22 11:36:17 PDT 2019

apolyakov marked an inline comment as done.
apolyakov added a comment.

In D60968#1474470 <https://reviews.llvm.org/D60968#1474470>, @clayborg wrote:

> Not sure what functionality this really adds? It seems to just wrap the OS plug-in python class in a different way?

You are right, for now the patch doesn't add new functionality, but this approach allows us to extend LLDB in a more flexible way, for example, if someday LLDB supports `CPU ID`, we will be able to fetch it from OS threads without modifying client's code.

Comment at: lldb/examples/python/lldb-os-plugin/arch/arc.py:15
+# Find the location of registers description file.
+_interp = lldb.debugger.GetCommandInterpreter()
+_result = lldb.SBCommandReturnObject()
clayborg wrote:
> We really shouldn't be using the "lldb.debugger" in the script, we would want this to be supplied to a function call. Top level code isn't always a great idea. If you import this module before the process is loaded "plugin.process.icd.hardware.registers" might not be available.
Thanks, I will consider it.

Comment at: lldb/examples/python/lldb-os-plugin/core/cvalue.py:1-7
+from typing import Any
+from utilities.tracing import traced
+import lldb
clayborg wrote:
> this is already in lldb.value in the lldb module. did you make additions to it? If so, modify that and remove this file
Yes I did. For now it's here just for example of how it could be modified in comparison to lldb.value

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list