aboutsummaryrefslogtreecommitdiff
path: root/lldb/docs/use/tutorials/accessing-documentation.md
blob: d14efa5f3c4280fa22c61ab3b587b098191ac6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Accessing Script Documentation

The LLDB API is contained in a python module named lldb. A useful resource when
writing Python extensions is the lldb Python classes reference guide.

The documentation is also accessible in an interactive debugger session with
the following command:

```python3
(lldb) script help(lldb)
   Help on package lldb:

   NAME
      lldb - The lldb module contains the public APIs for Python binding.

   FILE
      /System/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/__init__.py

   DESCRIPTION
...
```

You can also get help using a module class name. The full API that is exposed
for that class will be displayed in a man page style window. Below we want to
get help on the lldb.SBFrame class:

```python3
(lldb) script help(lldb.SBFrame)
   Help on class SBFrame in module lldb:

   class SBFrame(builtins.object)
    |  SBFrame(*args)
    |  
    |  Represents one of the stack frames associated with a thread.
    |  
    |  SBThread contains SBFrame(s). For example (from test/lldbutil.py), ::
    |  
    |      def print_stacktrace(thread, string_buffer = False):
    |          '''Prints a simple stack trace of this thread.'''
...
```

Or you can get help using any python object, here we use the lldb.process
object which is a global variable in the lldb module which represents the
currently selected process:

```python3
(lldb) script help(lldb.process)
   Help on SBProcess in module lldb object:

   class SBProcess(builtins.object)
    |  SBProcess(*args)
    |  
    |  Represents the process associated with the target program.
    |  
    |  SBProcess supports thread iteration. For example (from test/lldbutil.py), ::
    |  
    |      # ==================================================
    |      # Utility functions related to Threads and Processes
    |      # ==================================================
...
```