197 lines · plain
1:orphan:2 3lldb-server -- Server for LLDB Debugging Sessions4=================================================5 6.. program:: lldb-server7 8SYNOPSIS9--------10 11| :program:`lldb-server` v[ersion]12| :program:`lldb-server` g[dbserver] [*options*]13| :program:`lldb-server` p[latform] [*options*]14 15DESCRIPTION16-----------17 18:program:`lldb-server` provides the server counterpart of the LLVM debugger.19The server runs and monitors the debugged program, while the user interfaces20with it via a client, either running locally or connecting remotely.21 22All of the code in the LLDB project is available under the Apache 2.0 License23with LLVM exceptions.24 25COMMANDS26--------27 28The first argument to lldb-server specifies a command to run.29 30.. option:: v[ersion]31 32 Prints lldb-server version and exits.33 34.. option:: g[dbserver]35 36 Runs the server using the gdb-remote protocol. LLDB can afterwards37 connect to the server using *gdb-remote* command.38 39.. option:: p[latform]40 41 Runs the platform server. LLDB can afterwards connect to the server using42 *platform select*, followed by *platform connect*.43 44GDBSERVER COMMAND45-----------------46 47| :program:`lldb-server` g[dbserver] [*options*] [[*host*]:*port*] [[--] *program* *args*...]48 49CONNECTION50~~~~~~~~~~51 52.. option:: host:port53 54 Specifies the hostname and TCP port to listen on. Obligatory unless another55 listening option is used. If host is empty, *localhost* will be used. If port56 is zero, a random port will be selected, and written as specified by --pipe57 or --named-pipe options.58 59.. option:: --fd <fd>60 61 Communicate over the given file descriptor instead of sockets.62 63.. option:: --named-pipe <name>64 65 Write the listening port number to the specified named pipe.66 67.. option:: --pipe <fd>68 69 Write the listening port number to the specified pipe (fd).70 71.. option:: --reverse-connect72 73 Connect to the client instead of passively waiting for a connection. In this74 case, [host]:port denotes the remote address to connect to.75 76GENERAL OPTIONS77~~~~~~~~~~~~~~~78 79.. option:: --help80 81 Prints out the usage information and exits.82 83.. option:: --log-channels <channel1 categories...:channel2 categories...>84 85 Channels to log. A colon-separated list of entries. Each entry starts with86 a channel followed by a space-separated list of categories.87 88.. option:: --log-file <file>89 90 Destination file to log to. If empty, log to stderr.91 92.. option:: --setsid93 94 Run lldb-server in a new session.95 96TARGET SELECTION97~~~~~~~~~~~~~~~~98 99.. option:: --attach <pid-or-name>100 101 Attach to the process given by a (numeric) process id or a name.102 103.. option:: -- program args104 105 Launch a program for debugging.106 107If neither of target options are used, :program:`lldb-server` is started108without a specific target. It can be afterwards instructed by the client109to launch or attach.110 111PLATFORM COMMAND112----------------113 114| :program:`lldb-server` p[latform] [*options*] --server --listen [[*host*]:*port*]115 116CONNECTION117~~~~~~~~~~118 119.. option:: --server120 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.123 124.. option:: --listen <host>:<port>125 126 Hostname and port to listen on. Obligatory. If *port* is zero, a random port127 will be used.128 129.. option:: --socket-file <path>130 131 Write the listening socket port number to the specified file.132 133GENERAL OPTIONS134~~~~~~~~~~~~~~~135 136.. option:: --log-channels <channel1 categories...:channel2 categories...>137 138 Channels to log. A colon-separated list of entries. Each entry starts with139 a channel followed by a space-separated list of categories.140 141.. option:: --log-file <file>142 143 Destination file to log to. If empty, log to stderr.144 145GDB-SERVER CONNECTIONS146~~~~~~~~~~~~~~~~~~~~~~147 148.. option:: --gdbserver-port <port>149 150 Define a port to be used for gdb-server connections. This port is used for151 multiple connections.152 153EXAMPLES154--------155 156The server can be started in several modes.157 158In order to launch a new process inside the debugger, pass the path to it159and the arguments to the debugged executable as positional arguments.160To disambiguate between arguments passed to lldb and arguments passed161to the debugged executable, arguments starting with a - must be passed after162--. The server will launch the new executable and stop it immediately, waiting163for the client to connect.164 165 lldb-server g :1234 /path/to/program program-argument -- --program-option166 167For convenience, passing the executable after -- is also supported.168 169 lldb-server g :1234 -- /path/to/program program-argument --program-option170 171In order to attach to a running process, pass --attach along with the process172identifier or name. The process will be stopped immediately after starting173the server. Note that terminating the server will usually cause the process174to be detached and continue execution.175 176 lldb-server g :1234 --attach 12345177 lldb-server g :1234 --attach program-name178 179Use *gdb-remote* command to connect to the server:180 181 (lldb) gdb-remote 1234182 183lldb-server can also be started without an inferior. In this case, the client184can select the target after connecting to the server. Note that some commands185(e.g. *target create*) will disconnect and launch a local lldb-server instead.186 187 lldb-server g :1234188 189 (lldb) gdb-remote 1234190 (lldb) process launch a.out191 192SEE ALSO193--------194 195The LLDB project page https://lldb.llvm.org has many different resources196for :program:`lldb-server` users.197