1*e8d8bef9SDimitry Andric:orphan: 2*e8d8bef9SDimitry Andric 3*e8d8bef9SDimitry Andriclldb-server -- Server for LLDB Debugging Sessions 4*e8d8bef9SDimitry Andric================================================= 5*e8d8bef9SDimitry Andric 6*e8d8bef9SDimitry Andric.. program:: lldb-server 7*e8d8bef9SDimitry Andric 8*e8d8bef9SDimitry AndricSYNOPSIS 9*e8d8bef9SDimitry Andric-------- 10*e8d8bef9SDimitry Andric 11*e8d8bef9SDimitry Andric| :program:`lldb-server` v[ersion] 12*e8d8bef9SDimitry Andric| :program:`lldb-server` g[dbserver] [*options*] 13*e8d8bef9SDimitry Andric| :program:`lldb-server` p[latform] [*options*] 14*e8d8bef9SDimitry Andric 15*e8d8bef9SDimitry AndricDESCRIPTION 16*e8d8bef9SDimitry Andric----------- 17*e8d8bef9SDimitry Andric 18*e8d8bef9SDimitry Andric:program:`lldb-server` provides the server counterpart of the LLVM debugger. 19*e8d8bef9SDimitry AndricThe server runs and monitors the debugged program, while the user interfaces 20*e8d8bef9SDimitry Andricwith it via a client, either running locally or connecting remotely. 21*e8d8bef9SDimitry Andric 22*e8d8bef9SDimitry AndricAll of the code in the LLDB project is available under the Apache 2.0 License 23*e8d8bef9SDimitry Andricwith LLVM exceptions. 24*e8d8bef9SDimitry Andric 25*e8d8bef9SDimitry AndricCOMMANDS 26*e8d8bef9SDimitry Andric-------- 27*e8d8bef9SDimitry Andric 28*e8d8bef9SDimitry AndricThe first argument to lldb-server specifies a command to run. 29*e8d8bef9SDimitry Andric 30*e8d8bef9SDimitry Andric.. option:: v[ersion] 31*e8d8bef9SDimitry Andric 32*e8d8bef9SDimitry Andric Prints lldb-server version and exits. 33*e8d8bef9SDimitry Andric 34*e8d8bef9SDimitry Andric.. option:: g[dbserver] 35*e8d8bef9SDimitry Andric 36*e8d8bef9SDimitry Andric Runs the server using the gdb-remote protocol. LLDB can afterwards 37*e8d8bef9SDimitry Andric connect to the server using *gdb-remote* command. 38*e8d8bef9SDimitry Andric 39*e8d8bef9SDimitry Andric.. option:: p[latform] 40*e8d8bef9SDimitry Andric 41*e8d8bef9SDimitry Andric Runs the platform server. LLDB can afterwards connect to the server using 42*e8d8bef9SDimitry Andric *platform select*, followed by *platform connect*. 43*e8d8bef9SDimitry Andric 44*e8d8bef9SDimitry AndricGDBSERVER COMMAND 45*e8d8bef9SDimitry Andric----------------- 46*e8d8bef9SDimitry Andric 47*e8d8bef9SDimitry Andric| :program:`lldb-server` g[dbserver] [*options*] [[*host*]:*port*] [[--] *program* *args*...] 48*e8d8bef9SDimitry Andric 49*e8d8bef9SDimitry AndricCONNECTION 50*e8d8bef9SDimitry Andric~~~~~~~~~~ 51*e8d8bef9SDimitry Andric 52*e8d8bef9SDimitry Andric.. option:: host:port 53*e8d8bef9SDimitry Andric 54*e8d8bef9SDimitry Andric Specifies the hostname and TCP port to listen on. Obligatory unless another 55*e8d8bef9SDimitry Andric listening option is used. If host is empty, *localhost* will be used. If port 56*e8d8bef9SDimitry Andric is zero, a random port will be selected, and written as specified by --pipe 57*e8d8bef9SDimitry Andric or --named-pipe options. 58*e8d8bef9SDimitry Andric 59*e8d8bef9SDimitry Andric.. option:: --fd <fd> 60*e8d8bef9SDimitry Andric 61*e8d8bef9SDimitry Andric Communicate over the given file descriptor instead of sockets. 62*e8d8bef9SDimitry Andric 63*e8d8bef9SDimitry Andric.. option:: --named-pipe <name> 64*e8d8bef9SDimitry Andric 65*e8d8bef9SDimitry Andric Write the listening port number to the specified named pipe. 66*e8d8bef9SDimitry Andric 67*e8d8bef9SDimitry Andric.. option:: --pipe <fd> 68*e8d8bef9SDimitry Andric 69*e8d8bef9SDimitry Andric Write the listening port number to the specified pipe (fd). 70*e8d8bef9SDimitry Andric 71*e8d8bef9SDimitry Andric.. option:: --reverse-connect 72*e8d8bef9SDimitry Andric 73*e8d8bef9SDimitry Andric Connect to the client instead of passively waiting for a connection. In this 74*e8d8bef9SDimitry Andric case, [host]:port denotes the remote address to connect to. 75*e8d8bef9SDimitry Andric 76*e8d8bef9SDimitry AndricGENERAL OPTIONS 77*e8d8bef9SDimitry Andric~~~~~~~~~~~~~~~ 78*e8d8bef9SDimitry Andric 79*e8d8bef9SDimitry Andric.. option:: --help 80*e8d8bef9SDimitry Andric 81*e8d8bef9SDimitry Andric Prints out the usage information and exits. 82*e8d8bef9SDimitry Andric 83*e8d8bef9SDimitry Andric.. option:: --log-channels <channel1 categories...:channel2 categories...> 84*e8d8bef9SDimitry Andric 85*e8d8bef9SDimitry Andric Channels to log. A colon-separated list of entries. Each entry starts with 86*e8d8bef9SDimitry Andric a channel followed by a space-separated list of categories. 87*e8d8bef9SDimitry Andric 88*e8d8bef9SDimitry Andric.. option:: --log-file <file> 89*e8d8bef9SDimitry Andric 90*e8d8bef9SDimitry Andric Destination file to log to. If empty, log to stderr. 91*e8d8bef9SDimitry Andric 92*e8d8bef9SDimitry Andric.. option:: --setsid 93*e8d8bef9SDimitry Andric 94*e8d8bef9SDimitry Andric Run lldb-server in a new session. 95*e8d8bef9SDimitry Andric 96*e8d8bef9SDimitry AndricTARGET SELECTION 97*e8d8bef9SDimitry Andric~~~~~~~~~~~~~~~~ 98*e8d8bef9SDimitry Andric 99*e8d8bef9SDimitry Andric.. option:: --attach <pid-or-name> 100*e8d8bef9SDimitry Andric 101*e8d8bef9SDimitry Andric Attach to the process given by a (numeric) process id or a name. 102*e8d8bef9SDimitry Andric 103*e8d8bef9SDimitry Andric.. option:: -- program args 104*e8d8bef9SDimitry Andric 105*e8d8bef9SDimitry Andric Launch a program for debugging. 106*e8d8bef9SDimitry Andric 107*e8d8bef9SDimitry AndricIf neither of target options are used, :program:`lldb-server` is started 108*e8d8bef9SDimitry Andricwithout a specific target. It can be afterwards instructed by the client 109*e8d8bef9SDimitry Andricto launch or attach. 110*e8d8bef9SDimitry Andric 111*e8d8bef9SDimitry AndricPLATFORM COMMAND 112*e8d8bef9SDimitry Andric---------------- 113*e8d8bef9SDimitry Andric 114*e8d8bef9SDimitry Andric| :program:`lldb-server` p[latform] [*options*] --server --listen [[*host*]:*port*] 115*e8d8bef9SDimitry Andric 116*e8d8bef9SDimitry AndricCONNECTION 117*e8d8bef9SDimitry Andric~~~~~~~~~~ 118*e8d8bef9SDimitry Andric 119*e8d8bef9SDimitry Andric.. option:: --server 120*e8d8bef9SDimitry Andric 121*e8d8bef9SDimitry Andric Run in server mode, handling multiple connections. If this is not specified, 122*e8d8bef9SDimitry Andric lldb-server will accept only one connection and exit when it is finished. 123*e8d8bef9SDimitry Andric 124*e8d8bef9SDimitry Andric.. option:: --listen <host>:<port> 125*e8d8bef9SDimitry Andric 126*e8d8bef9SDimitry Andric Hostname and port to listen on. Obligatory. If *port* is zero, a random port 127*e8d8bef9SDimitry Andric will be used. 128*e8d8bef9SDimitry Andric 129*e8d8bef9SDimitry Andric.. option:: --socket-file <path> 130*e8d8bef9SDimitry Andric 131*e8d8bef9SDimitry Andric Write the listening socket port number to the specified file. 132*e8d8bef9SDimitry Andric 133*e8d8bef9SDimitry AndricGENERAL OPTIONS 134*e8d8bef9SDimitry Andric~~~~~~~~~~~~~~~ 135*e8d8bef9SDimitry Andric 136*e8d8bef9SDimitry Andric.. option:: --log-channels <channel1 categories...:channel2 categories...> 137*e8d8bef9SDimitry Andric 138*e8d8bef9SDimitry Andric Channels to log. A colon-separated list of entries. Each entry starts with 139*e8d8bef9SDimitry Andric a channel followed by a space-separated list of categories. 140*e8d8bef9SDimitry Andric 141*e8d8bef9SDimitry Andric.. option:: --log-file <file> 142*e8d8bef9SDimitry Andric 143*e8d8bef9SDimitry Andric Destination file to log to. If empty, log to stderr. 144*e8d8bef9SDimitry Andric 145*e8d8bef9SDimitry AndricGDB-SERVER CONNECTIONS 146*e8d8bef9SDimitry Andric~~~~~~~~~~~~~~~~~~~~~~ 147*e8d8bef9SDimitry Andric 148*e8d8bef9SDimitry Andric.. option:: --gdbserver-port <port> 149*e8d8bef9SDimitry Andric 150*e8d8bef9SDimitry Andric Define a port to be used for gdb-server connections. Can be specified multiple 151*e8d8bef9SDimitry Andric times to allow multiple ports. Has no effect if --min-gdbserver-port 152*e8d8bef9SDimitry Andric and --max-gdbserver-port are specified. 153*e8d8bef9SDimitry Andric 154*e8d8bef9SDimitry Andric.. option:: --min-gdbserver-port <port> 155*e8d8bef9SDimitry Andric.. option:: --max-gdbserver-port <port> 156*e8d8bef9SDimitry Andric 157*e8d8bef9SDimitry Andric Specify the range of ports that can be used for gdb-server connections. Both 158*e8d8bef9SDimitry Andric options need to be specified simultaneously. Overrides --gdbserver-port. 159*e8d8bef9SDimitry Andric 160*e8d8bef9SDimitry Andric.. option:: --port-offset <offset> 161*e8d8bef9SDimitry Andric 162*e8d8bef9SDimitry Andric Add the specified offset to port numbers returned by server. This is useful 163*e8d8bef9SDimitry Andric if the server is running behind a firewall, and a range of ports is redirected 164*e8d8bef9SDimitry Andric to it with an offset. 165*e8d8bef9SDimitry Andric 166*e8d8bef9SDimitry AndricEXAMPLES 167*e8d8bef9SDimitry Andric-------- 168*e8d8bef9SDimitry Andric 169*e8d8bef9SDimitry AndricThe server can be started in several modes. 170*e8d8bef9SDimitry Andric 171*e8d8bef9SDimitry AndricIn order to launch a new process inside the debugger, pass the path to it 172*e8d8bef9SDimitry Andricand the arguments to the debugged executable as positional arguments. 173*e8d8bef9SDimitry AndricTo disambiguate between arguments passed to lldb and arguments passed 174*e8d8bef9SDimitry Andricto the debugged executable, arguments starting with a - must be passed after 175*e8d8bef9SDimitry Andric--. The server will launch the new executable and stop it immediately, waiting 176*e8d8bef9SDimitry Andricfor the client to connect. 177*e8d8bef9SDimitry Andric 178*e8d8bef9SDimitry Andric lldb-server g :1234 /path/to/program program-argument -- --program-option 179*e8d8bef9SDimitry Andric 180*e8d8bef9SDimitry AndricFor convenience, passing the executable after -- is also supported. 181*e8d8bef9SDimitry Andric 182*e8d8bef9SDimitry Andric lldb-server g :1234 -- /path/to/program program-argument --program-option 183*e8d8bef9SDimitry Andric 184*e8d8bef9SDimitry AndricIn order to attach to a running process, pass --attach along with the process 185*e8d8bef9SDimitry Andricidentifier or name. The process will be stopped immediately after starting 186*e8d8bef9SDimitry Andricthe server. Note that terminating the server will usually cause the process 187*e8d8bef9SDimitry Andricto be detached and continue execution. 188*e8d8bef9SDimitry Andric 189*e8d8bef9SDimitry Andric lldb-server g :1234 --attach 12345 190*e8d8bef9SDimitry Andric lldb-server g :1234 --attach program-name 191*e8d8bef9SDimitry Andric 192*e8d8bef9SDimitry AndricUse *gdb-remote* command to connect to the server: 193*e8d8bef9SDimitry Andric 194*e8d8bef9SDimitry Andric (lldb) gdb-remote 1234 195*e8d8bef9SDimitry Andric 196*e8d8bef9SDimitry Andriclldb-server can also be started without an inferior. In this case, the client 197*e8d8bef9SDimitry Andriccan select the target after connecting to the server. Note that some commands 198*e8d8bef9SDimitry Andric(e.g. *target create*) will disconnect and launch a local lldb-server instead. 199*e8d8bef9SDimitry Andric 200*e8d8bef9SDimitry Andric lldb-server g :1234 201*e8d8bef9SDimitry Andric 202*e8d8bef9SDimitry Andric (lldb) gdb-remote 1234 203*e8d8bef9SDimitry Andric (lldb) process launch a.out 204*e8d8bef9SDimitry Andric 205*e8d8bef9SDimitry AndricSEE ALSO 206*e8d8bef9SDimitry Andric-------- 207*e8d8bef9SDimitry Andric 208*e8d8bef9SDimitry AndricThe LLDB project page https://lldb.llvm.org has many different resources 209*e8d8bef9SDimitry Andricfor :program:`lldb-server` users. 210