[lldb] Allow flexible importing of in_call_stack
authorDave Lee <davelee.com@gmail.com>
Fri, 11 Nov 2022 20:18:37 +0000 (12:18 -0800)
committerDave Lee <davelee.com@gmail.com>
Fri, 11 Nov 2022 22:28:40 +0000 (14:28 -0800)
Allow `in_call_stack` to be imported in either of the following ways:

```
command script import path/to/in_call_stack.py
command script import lldb.utils.in_call_stack
```

rdar://102249295

Differential Revision: https://reviews.llvm.org/D137860

lldb/examples/python/in_call_stack.py

index 0647f2c..9fd32c0 100755 (executable)
@@ -3,7 +3,7 @@
 
 def __lldb_init_module(debugger, internal_dict):
   debugger.HandleCommand(
-      'command alias in_call_stack breakpoint command add --python-function in_call_stack.in_call_stack -k name -v %1'
+      f'command alias in_call_stack breakpoint command add --python-function {__name__}.in_call_stack -k name -v %1'
   )