xref: /llvm-project/lldb/docs/man/lldb-server.rst (revision 2e89312419c5f7875c947fcf79ea0446cf65a287)
125c40a45SMichał Górny:orphan:
225c40a45SMichał Górny
325c40a45SMichał Górnylldb-server -- Server for LLDB Debugging Sessions
425c40a45SMichał Górny=================================================
525c40a45SMichał Górny
625c40a45SMichał Górny.. program:: lldb-server
725c40a45SMichał Górny
825c40a45SMichał GórnySYNOPSIS
925c40a45SMichał Górny--------
1025c40a45SMichał Górny
1125c40a45SMichał Górny| :program:`lldb-server` v[ersion]
1225c40a45SMichał Górny| :program:`lldb-server` g[dbserver] [*options*]
1325c40a45SMichał Górny| :program:`lldb-server` p[latform] [*options*]
1425c40a45SMichał Górny
1525c40a45SMichał GórnyDESCRIPTION
1625c40a45SMichał Górny-----------
1725c40a45SMichał Górny
1825c40a45SMichał Górny:program:`lldb-server` provides the server counterpart of the LLVM debugger.
1925c40a45SMichał GórnyThe server runs and monitors the debugged program, while the user interfaces
2025c40a45SMichał Górnywith it via a client, either running locally or connecting remotely.
2125c40a45SMichał Górny
2225c40a45SMichał GórnyAll of the code in the LLDB project is available under the Apache 2.0 License
2325c40a45SMichał Górnywith LLVM exceptions.
2425c40a45SMichał Górny
2525c40a45SMichał GórnyCOMMANDS
2625c40a45SMichał Górny--------
2725c40a45SMichał Górny
2825c40a45SMichał GórnyThe first argument to lldb-server specifies a command to run.
2925c40a45SMichał Górny
3025c40a45SMichał Górny.. option:: v[ersion]
3125c40a45SMichał Górny
3225c40a45SMichał Górny Prints lldb-server version and exits.
3325c40a45SMichał Górny
3425c40a45SMichał Górny.. option:: g[dbserver]
3525c40a45SMichał Górny
3625c40a45SMichał Górny Runs the server using the gdb-remote protocol. LLDB can afterwards
3725c40a45SMichał Górny connect to the server using *gdb-remote* command.
3825c40a45SMichał Górny
3925c40a45SMichał Górny.. option:: p[latform]
4025c40a45SMichał Górny
4125c40a45SMichał Górny Runs the platform server. LLDB can afterwards connect to the server using
4225c40a45SMichał Górny *platform select*, followed by *platform connect*.
4325c40a45SMichał Górny
4425c40a45SMichał GórnyGDBSERVER COMMAND
4525c40a45SMichał Górny-----------------
4625c40a45SMichał Górny
4725c40a45SMichał Górny| :program:`lldb-server` g[dbserver] [*options*] [[*host*]:*port*] [[--] *program* *args*...]
4825c40a45SMichał Górny
4925c40a45SMichał GórnyCONNECTION
5025c40a45SMichał Górny~~~~~~~~~~
5125c40a45SMichał Górny
5225c40a45SMichał Górny.. option:: host:port
5325c40a45SMichał Górny
5425c40a45SMichał Górny Specifies the hostname and TCP port to listen on. Obligatory unless another
5525c40a45SMichał Górny listening option is used. If host is empty, *localhost* will be used.  If port
5625c40a45SMichał Górny is zero, a random port will be selected, and written as specified by --pipe
5725c40a45SMichał Górny or --named-pipe options.
5825c40a45SMichał Górny
5925c40a45SMichał Górny.. option:: --fd <fd>
6025c40a45SMichał Górny
6125c40a45SMichał Górny Communicate over the given file descriptor instead of sockets.
6225c40a45SMichał Górny
6325c40a45SMichał Górny.. option:: --named-pipe <name>
6425c40a45SMichał Górny
6525c40a45SMichał Górny Write the listening port number to the specified named pipe.
6625c40a45SMichał Górny
6725c40a45SMichał Górny.. option:: --pipe <fd>
6825c40a45SMichał Górny
6925c40a45SMichał Górny Write the listening port number to the specified pipe (fd).
7025c40a45SMichał Górny
7125c40a45SMichał Górny.. option:: --reverse-connect
7225c40a45SMichał Górny
7325c40a45SMichał Górny Connect to the client instead of passively waiting for a connection. In this
7425c40a45SMichał Górny case, [host]:port denotes the remote address to connect to.
7525c40a45SMichał Górny
7625c40a45SMichał GórnyGENERAL OPTIONS
7725c40a45SMichał Górny~~~~~~~~~~~~~~~
7825c40a45SMichał Górny
7925c40a45SMichał Górny.. option:: --help
8025c40a45SMichał Górny
8125c40a45SMichał Górny Prints out the usage information and exits.
8225c40a45SMichał Górny
8325c40a45SMichał Górny.. option:: --log-channels <channel1 categories...:channel2 categories...>
8425c40a45SMichał Górny
8525c40a45SMichał Górny Channels to log. A colon-separated list of entries. Each entry starts with
8625c40a45SMichał Górny a channel followed by a space-separated list of categories.
8725c40a45SMichał Górny
8825c40a45SMichał Górny.. option:: --log-file <file>
8925c40a45SMichał Górny
9025c40a45SMichał Górny Destination file to log to. If empty, log to stderr.
9125c40a45SMichał Górny
9225c40a45SMichał Górny.. option:: --setsid
9325c40a45SMichał Górny
9425c40a45SMichał Górny Run lldb-server in a new session.
9525c40a45SMichał Górny
9625c40a45SMichał GórnyTARGET SELECTION
9725c40a45SMichał Górny~~~~~~~~~~~~~~~~
9825c40a45SMichał Górny
9925c40a45SMichał Górny.. option:: --attach <pid-or-name>
10025c40a45SMichał Górny
10125c40a45SMichał Górny Attach to the process given by a (numeric) process id or a name.
10225c40a45SMichał Górny
10325c40a45SMichał Górny.. option:: -- program args
10425c40a45SMichał Górny
10525c40a45SMichał Górny Launch a program for debugging.
10625c40a45SMichał Górny
10725c40a45SMichał GórnyIf neither of target options are used, :program:`lldb-server` is started
10825c40a45SMichał Górnywithout a specific target. It can be afterwards instructed by the client
10925c40a45SMichał Górnyto launch or attach.
11025c40a45SMichał Górny
11125c40a45SMichał GórnyPLATFORM COMMAND
11225c40a45SMichał Górny----------------
11325c40a45SMichał Górny
11425c40a45SMichał Górny| :program:`lldb-server` p[latform] [*options*] --server --listen [[*host*]:*port*]
11525c40a45SMichał Górny
11625c40a45SMichał GórnyCONNECTION
11725c40a45SMichał Górny~~~~~~~~~~
11825c40a45SMichał Górny
11925c40a45SMichał Górny.. option:: --server
12025c40a45SMichał Górny
12125c40a45SMichał Górny Run in server mode, handling multiple connections. If this is not specified,
12225c40a45SMichał Górny lldb-server will accept only one connection and exit when it is finished.
12325c40a45SMichał Górny
12425c40a45SMichał Górny.. option:: --listen <host>:<port>
12525c40a45SMichał Górny
12625c40a45SMichał Górny Hostname and port to listen on. Obligatory. If *port* is zero, a random port
12725c40a45SMichał Górny will be used.
12825c40a45SMichał Górny
12925c40a45SMichał Górny.. option:: --socket-file <path>
13025c40a45SMichał Górny
13125c40a45SMichał Górny Write the listening socket port number to the specified file.
13225c40a45SMichał Górny
13325c40a45SMichał GórnyGENERAL OPTIONS
13425c40a45SMichał Górny~~~~~~~~~~~~~~~
13525c40a45SMichał Górny
13625c40a45SMichał Górny.. option:: --log-channels <channel1 categories...:channel2 categories...>
13725c40a45SMichał Górny
13825c40a45SMichał Górny Channels to log. A colon-separated list of entries. Each entry starts with
13925c40a45SMichał Górny a channel followed by a space-separated list of categories.
14025c40a45SMichał Górny
14125c40a45SMichał Górny.. option:: --log-file <file>
14225c40a45SMichał Górny
14325c40a45SMichał Górny Destination file to log to. If empty, log to stderr.
14425c40a45SMichał Górny
14525c40a45SMichał GórnyGDB-SERVER CONNECTIONS
14625c40a45SMichał Górny~~~~~~~~~~~~~~~~~~~~~~
14725c40a45SMichał Górny
14825c40a45SMichał Górny.. option:: --gdbserver-port <port>
14925c40a45SMichał Górny
150*2e893124SDmitry Vasilyev Define a port to be used for gdb-server connections. This port is used for
151*2e893124SDmitry Vasilyev multiple connections.
15225c40a45SMichał Górny
15325c40a45SMichał GórnyEXAMPLES
15425c40a45SMichał Górny--------
15525c40a45SMichał Górny
15625c40a45SMichał GórnyThe server can be started in several modes.
15725c40a45SMichał Górny
15825c40a45SMichał GórnyIn order to launch a new process inside the debugger, pass the path to it
15925c40a45SMichał Górnyand the arguments to the debugged executable as positional arguments.
16025c40a45SMichał GórnyTo disambiguate between arguments passed to lldb and arguments passed
16125c40a45SMichał Górnyto the debugged executable, arguments starting with a - must be passed after
16225c40a45SMichał Górny--. The server will launch the new executable and stop it immediately, waiting
16325c40a45SMichał Górnyfor the client to connect.
16425c40a45SMichał Górny
16525c40a45SMichał Górny  lldb-server g :1234 /path/to/program program-argument -- --program-option
16625c40a45SMichał Górny
16725c40a45SMichał GórnyFor convenience, passing the executable after -- is also supported.
16825c40a45SMichał Górny
16925c40a45SMichał Górny  lldb-server g :1234 -- /path/to/program program-argument --program-option
17025c40a45SMichał Górny
17125c40a45SMichał GórnyIn order to attach to a running process, pass --attach along with the process
17225c40a45SMichał Górnyidentifier or name. The process will be stopped immediately after starting
17325c40a45SMichał Górnythe server. Note that terminating the server will usually cause the process
17425c40a45SMichał Górnyto be detached and continue execution.
17525c40a45SMichał Górny
17625c40a45SMichał Górny  lldb-server g :1234 --attach 12345
17725c40a45SMichał Górny  lldb-server g :1234 --attach program-name
17825c40a45SMichał Górny
17925c40a45SMichał GórnyUse *gdb-remote* command to connect to the server:
18025c40a45SMichał Górny
18125c40a45SMichał Górny  (lldb) gdb-remote 1234
18225c40a45SMichał Górny
18325c40a45SMichał Górnylldb-server can also be started without an inferior. In this case, the client
18425c40a45SMichał Górnycan select the target after connecting to the server. Note that some commands
18525c40a45SMichał Górny(e.g. *target create*) will disconnect and launch a local lldb-server instead.
18625c40a45SMichał Górny
18725c40a45SMichał Górny  lldb-server g :1234
18825c40a45SMichał Górny
18925c40a45SMichał Górny  (lldb) gdb-remote 1234
19025c40a45SMichał Górny  (lldb) process launch a.out
19125c40a45SMichał Górny
19225c40a45SMichał GórnySEE ALSO
19325c40a45SMichał Górny--------
19425c40a45SMichał Górny
19525c40a45SMichał GórnyThe LLDB project page https://lldb.llvm.org has many different resources
19625c40a45SMichał Górnyfor :program:`lldb-server` users.
197