[lldb][docs] Add troubleshooting section to scripting introduction

Logs just helped someone on Discord debug an issue in a way that would
not have been possible just by stepping the Python script. It was that
LLDB could not find the lldb-server binary.

We do talk about logs elsewhere but I think it's fine to repeat
here since it's a lot of people's first experience with scripting.
This commit is contained in:
David Spickett
2025-10-31 14:00:07 +00:00
parent 1fe3b2d81b
commit 19bf0adfd0

View File

@@ -147,3 +147,20 @@ SBFunction: id = 0x0000002e, name = main, type = main
a.out[0x714]: mov w0, #0x0 ; =0
a.out[0x718]: ret
```
### Troubleshooting
You can use all the usual Python tools to debug scripts, and on top of that
you can enable LLDB's log channels. To do this in the script shown above, add
this line right after `debugger` has been assigned:
```python
debugger.EnableLog("lldb", ["all"])
```
`lldb` `all` enables a lot of different channels, so you will probably want
to enable only a few channels once you know what you are interested in.
This API call is the equivalent of `log enable lldb all` when using LLDB
interactively. All channels available to `log enable` can be enabled using
`EnableLog` too.