[Lldb-commits] [lldb] [lldb-dap][docs] Improve README (PR #109266)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 09:42:36 PDT 2024


================
@@ -204,12 +171,67 @@ The default hostname being used `localhost`.
 }
 ```
 
-## Custom debugger commands
+### Configuration Settings Reference
+
+For both launch and attach configurations, lldb-dap accepts the following `lldb-dap`
+specific key/value pairs:
+
+|parameter          |type|req |         |
+|-------------------|----|:--:|---------|
+|**name**           |string|Y| A configuration name that will be displayed in the IDE.
+|**type**           |string|Y| Must be "lldb-dap".
+|**request**        |string|Y| Must be "launch" or "attach".
+|**program**        |string|Y| Path to the executable to launch.
+|**sourcePath**     |string| | Specify a source path to remap \"./\" to allow full paths to be used when setting breakpoints in binaries that have relative source paths.
+|**sourceMap**      |[string[2]]| | Specify an array of path re-mappings. Each element in the array must be a two element array containing a source and destination pathname. Overrides sourcePath.
+|**debuggerRoot**   | string| |Specify a working directory to use when launching lldb-dap. If the debug information in your executable contains relative paths, this option can be used so that `lldb-dap` can find source files and object files that have relative paths.
+|**commandEscapePrefix** | string | | The escape prefix to use for executing regular LLDB commands in the Debug Console, instead of printing variables. Defaults to a back-tick (`\``). If it's an empty string, then all expression in the Debug Console are treated as regular LLDB commands.
+|**customFrameFormat** | string | | If non-empty, stack frames will have descriptions generated based on the provided format. See https://lldb.llvm.org/use/formatting.html for an explanation on format strings for frames. If the format string contains errors, an error message will be displayed on the Debug Console and the default frame names will be used. This might come with a performance cost because debug information might need to be processed to generate the description.
+|**customThreadFormat** | string | | Same as `customFrameFormat`, but for threads instead of stack frames.
+|**initCommands**   |[string]| | LLDB commands executed upon debugger startup prior to creating the LLDB target.
+|**preRunCommands** |[string]| | LLDB commands executed just before launching/attaching, after the LLDB target has been created.
+|**stopCommands**   |[string]| | LLDB commands executed just after each stop.
+|**exitCommands**   |[string]| | LLDB commands executed when the program exits.
+|**terminateCommands** |[string]| | LLDB commands executed when the debugging session ends.
+
+All commands and command outputs will be sent to the debugger console when they are executed.
+
+For JSON configurations of `"type": "launch"`, the JSON configuration can additionally
+contain the following key/value pairs:
+
+|parameter          |type|req |         |
+|-------------------|----|:--:|---------|
+|**program**        |string|Y| Path to the executable to launch.
+|**args**           |[string]|| An array of command line argument strings to be passed to the program being launched.
+|**cwd**            |string| | The program working directory.
+|**env**            |dictionary| | Environment variables to set when launching the program. The format of each environment variable string is "VAR=VALUE" for environment variables with values or just "VAR" for environment variables with no values.
+|**stopOnEntry**    |boolean| | Whether to stop program immediately after launching.
+|**runInTerminal**  |boolean| | Launch the program inside an integrated terminal in the IDE. Useful for debugging interactive command line programs.
+|**launchCommands** |[string]| | LLDB commands executed to launch the program.
+
+For JSON configurations of `"type": "attach"`, the JSON configuration can contain
+the following `lldb-dap` specific key/value pairs:
+
+|parameter          |type    |req |         |
+|-------------------|--------|:--:|---------|
+|**program**        |string  | | Path to the executable to attach to. This value is optional but can help to resolve breakpoints prior the attaching to the program.
+|**pid**            |number  | | The process id of the process you wish to attach to. If **pid** is omitted, the debugger will attempt to attach to the program by finding a process whose file name matches the file name from **porgram**. Setting this value to `${command:pickMyProcess}` will allow interactive process selection in the IDE.
+|**waitFor**        |boolean | | Wait for the process to launch.
+|**attachCommands** |[string]| | LLDB commands that will be executed after **preRunCommands** which take place of the code that normally does the attach. The commands can create a new target and attach or launch it however desired. This allows custom launch and attach configurations. Core files can use `target create --core /path/to/core` to attach to core files.
+
+## Debug Console
+
+The debug console allows printing variables / expressions and executing lldb commands.
+By default, all provided commands are interpreteted as variable names / expressions whose values will be printed to the Debug Console.
+To execute regular LLDB commands, prefix them with the `\`` character.
+The escape character can be changed via the `commandEscapePrefix` configuration option.
+
+### lldb-dap specific commands
 
 The `lldb-dap` tool includes additional custom commands to support the Debug
 Adapter Protocol features.
 
-### startDebugging
+#### `lldb-dap.startDebugging`
----------------
ashgti wrote:

nit: Below doesn't have a space, but this does.

https://github.com/llvm/llvm-project/pull/109266


More information about the lldb-commits mailing list