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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 17:09:45 PDT 2024


clayborg wrote:

To extend on Pavel's modification of my idea:
```
class ScriptedPlatform:
  def extends_platform_name(self):
    '''Get the name of the internal platform this class extends.'''
    return "iPhoneOS.platform"
```
Then every function would have 3 variants:
```
def pre_XXX(...):
def XXX(...)
def post_XXX(...)
```
So for "attach_to_process" this would mean the possible functions are:
```
class ScriptedPlatform:
  def pre_attach_to_process(self, ...):
    # Called before the extended platform default attach_to_process() functionality
    # but only if `def extends_platform_name(self)` exists in this class. The default
    # attach_to_process() from the extended platform will be called after this function
    # completes.

  def attach_to_process(self, ...):
    # This will override the attach_to_process() functionality. Clients that implement
    # this function should not override pre_attach_to_process() or 
    # post_attach_to_process() as everything can be done in this function.

  def post_attach_to_process(...)
    # Called after the extended platform's default attach_to_process() functionality
    # but only if `def extends_platform_name(self)` exists in this class. 
```

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


More information about the lldb-commits mailing list