llvm-project/lldb/examples
Dave Lee 1441ffe6a6 [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom
Update examples and docs to demonstrate using `__lldb_init_module` instead of
the idiom that checks for `lldb.debugger` at the top-level.

```
if __name__ == '__main__':
    ...
elif lldb.debugger:
    ...
```

Is replaced with:

```
if __name__ == '__main__':
    ...

def __lldb_init_module(debugger, internal_dict):
    ...
```

This change is for two reasons. First, it's generally encouraged not to only
use the convenience singletons (`lldb.{debugger,process,target,etc}`)
interactively from the `script` command. Second, there's a bug where
registering a python class as a command (using `command script add -c ...`),
result in the command not being runnable. Note that registering function-backed
commands does not have this bug.

Differential Revision: https://reviews.llvm.org/D117237
2022-01-13 16:37:49 -08:00
..
customization
darwin/heap_find [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom 2022-01-13 16:37:49 -08:00
functions
interposing/darwin/fd_interposing [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
lookup
plugins/commands
python [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom 2022-01-13 16:37:49 -08:00
scripting
summaries
synthetic [formatters] Add a deque formatter for libstdcpp and fix the libcxx one 2021-12-06 13:42:03 -08:00
test [lldb] Remove LLDB session dir and just store test traces in the respective test build directory 2020-12-04 11:43:10 +01:00