3 lldb-server -- Server for LLDB Debugging Sessions
4 =================================================
6 .. program:: lldb-server
11 | :program:`lldb-server` v[ersion]
12 | :program:`lldb-server` g[dbserver] [*options*]
13 | :program:`lldb-server` p[latform] [*options*]
18 :program:`lldb-server` provides the server counterpart of the LLVM debugger.
19 The server runs and monitors the debugged program, while the user interfaces
20 with it via a client, either running locally or connecting remotely.
22 All of the code in the LLDB project is available under the Apache 2.0 License
28 The first argument to lldb-server specifies a command to run.
32 Prints lldb-server version and exits.
34 .. option:: g[dbserver]
36 Runs the server using the gdb-remote protocol. LLDB can afterwards
37 connect to the server using *gdb-remote* command.
39 .. option:: p[latform]
41 Runs the platform server. LLDB can afterwards connect to the server using
42 *platform select*, followed by *platform connect*.
47 | :program:`lldb-server` g[dbserver] [*options*] [[*host*]:*port*] [[--] *program* *args*...]
54 Specifies the hostname and TCP port to listen on. Obligatory unless another
55 listening option is used. If host is empty, *localhost* will be used. If port
56 is zero, a random port will be selected, and written as specified by --pipe
57 or --named-pipe options.
61 Communicate over the given file descriptor instead of sockets.
63 .. option:: --named-pipe <name>
65 Write the listening port number to the specified named pipe.
67 .. option:: --pipe <fd>
69 Write the listening port number to the specified pipe (fd).
71 .. option:: --reverse-connect
73 Connect to the client instead of passively waiting for a connection. In this
74 case, [host]:port denotes the remote address to connect to.
81 Prints out the usage information and exits.
83 .. option:: --log-channels <channel1 categories...:channel2 categories...>
85 Channels to log. A colon-separated list of entries. Each entry starts with
86 a channel followed by a space-separated list of categories.
88 .. option:: --log-file <file>
90 Destination file to log to. If empty, log to stderr.
94 Run lldb-server in a new session.
99 .. option:: --attach <pid-or-name>
101 Attach to the process given by a (numeric) process id or a name.
103 .. option:: -- program args
105 Launch a program for debugging.
107 If neither of target options are used, :program:`lldb-server` is started
108 without a specific target. It can be afterwards instructed by the client
114 | :program:`lldb-server` p[latform] [*options*] --server --listen [[*host*]:*port*]
121 Run in server mode, handling multiple connections. If this is not specified,
122 lldb-server will accept only one connection and exit when it is finished.
124 .. option:: --listen <host>:<port>
126 Hostname and port to listen on. Obligatory. If *port* is zero, a random port
129 .. option:: --socket-file <path>
131 Write the listening socket port number to the specified file.
136 .. option:: --log-channels <channel1 categories...:channel2 categories...>
138 Channels to log. A colon-separated list of entries. Each entry starts with
139 a channel followed by a space-separated list of categories.
141 .. option:: --log-file <file>
143 Destination file to log to. If empty, log to stderr.
145 GDB-SERVER CONNECTIONS
146 ~~~~~~~~~~~~~~~~~~~~~~
148 .. option:: --gdbserver-port <port>
150 Define a port to be used for gdb-server connections. This port is used for
151 multiple connections.
156 The server can be started in several modes.
158 In order to launch a new process inside the debugger, pass the path to it
159 and the arguments to the debugged executable as positional arguments.
160 To disambiguate between arguments passed to lldb and arguments passed
161 to the debugged executable, arguments starting with a - must be passed after
162 --. The server will launch the new executable and stop it immediately, waiting
163 for the client to connect.
165 lldb-server g :1234 /path/to/program program-argument -- --program-option
167 For convenience, passing the executable after -- is also supported.
169 lldb-server g :1234 -- /path/to/program program-argument --program-option
171 In order to attach to a running process, pass --attach along with the process
172 identifier or name. The process will be stopped immediately after starting
173 the server. Note that terminating the server will usually cause the process
174 to be detached and continue execution.
176 lldb-server g :1234 --attach 12345
177 lldb-server g :1234 --attach program-name
179 Use *gdb-remote* command to connect to the server:
181 (lldb) gdb-remote 1234
183 lldb-server can also be started without an inferior. In this case, the client
184 can select the target after connecting to the server. Note that some commands
185 (e.g. *target create*) will disconnect and launch a local lldb-server instead.
189 (lldb) gdb-remote 1234
190 (lldb) process launch a.out
195 The LLDB project page https://lldb.llvm.org has many different resources
196 for :program:`lldb-server` users.