llvm-project/lldb
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
..
bindings [lldb] Remove lldbconfig module 2022-01-07 15:58:43 -08:00
cmake [lldb] Use `GNUInstallDirs` to support custom installation dirs. 2021-12-22 00:28:53 +00:00
docs [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom 2022-01-13 16:37:49 -08:00
examples [lldb] Use __lldb_init_module instead of "if lldb.debugger" idiom 2022-01-13 16:37:49 -08:00
include/lldb Revert "Revert "[LLDB][NativePDB] Add support for inlined functions"" 2022-01-13 14:00:24 -08:00
packages/Python/lldbsuite [lldb] [llgs] Implement qXfer:siginfo:read 2022-01-13 11:24:36 +01:00
resources [lldb] Remove stale LLDB-Info.plist 2021-01-08 10:12:16 -08:00
scripts Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk 2021-02-25 11:32:27 +01:00
source [lldb] Fix that the embedded Python REPL crashes if it receives SIGINT 2022-01-13 15:27:38 -08:00
test [lldb] Fix that the embedded Python REPL crashes if it receives SIGINT 2022-01-13 15:27:38 -08:00
third_party/Python/module [lldb][NFC] Inclusive language: replace master/slave names for ptys 2021-11-12 10:54:18 -06:00
tools [lldb] Remove lldb-instr 2022-01-10 11:48:16 -08:00
unittests [lldb] Remove reproducer instrumentation 2022-01-09 21:40:55 -08:00
utils [lldb] Match test dependencies name to other LLVM projects. 2021-05-21 00:10:27 -07:00
.clang-format
.clang-tidy [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
.gitignore
CMakeLists.txt [lldb] Use `GNUInstallDirs` to support custom installation dirs. 2021-12-22 00:28:53 +00:00
CODE_OWNERS.txt [CODE OWNERS] Add wallace as code owner 2022-01-12 12:36:30 -08:00
LICENSE.TXT
use_lldb_suite_root.py