Skip to content

Commit fe108b5

Browse files
committed
Docs
1 parent 5149cef commit fe108b5

File tree

7 files changed

+170
-79
lines changed

7 files changed

+170
-79
lines changed

CHANGELOG.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Release Notes
22

3+
# 1.11.0
4+
5+
### New
6+
- Updated bundled LLDB to v19.1.0.
7+
- The Python module implementing the CodeLLDB Python API is now called `codelldb` (aliased to `debugger` for backward
8+
compatibility).
9+
- Python scripts running in the context of CodeLLDB can now read workspace configuration settings stored under
10+
the `lldb.script` namespace via `codelldb.get_config()`.
11+
12+
### Changed
13+
- To reduce the maintenance burden, support for the Rust language service and custom data formatters in CodeLLDB has
14+
been removed. The constant breaking changes in LLDB's language service API, along with Rust's evolving internal
15+
representation of `std::` types, have made it increasingly difficult to maintain these updates. Future versions of
16+
CodeLLDB will be based on stock LLDB, without the Rust language service. Rust data types will still have partial
17+
support via the data formatters provided by `rustc`, but custom formatters will no longer be maintained.
18+
319
# 1.10.0
420

521
## New
@@ -14,12 +30,12 @@
1430
# 1.9.2
1531

1632
## New
17-
- Implemented [Excluded Callers](MANUAL.md#excluded-callers) feature, similar to the [one in Javascript debugger](https://code.visualstudio.com/updates/v1_64#_javascript-debugging).
33+
- Implemented [Excluded Callers](MANUAL.md#excluded-callers) feature, similar to the
34+
[one in Javascript debugger](https://code.visualstudio.com/updates/v1_64#_javascript-debugging).
1835
- Added [create_webview()](MANUAL.md#webview) Python API, which allows scripts to create and manipulate VSCode Webviews.
19-
This function supersedes functionality of the older `display_html` API.
36+
This function supersedes functionality of the older `display_html` API.
2037
- Enabled conditions on exception breakpoints.
2138

22-
2339
# 1.9.1
2440

2541
## New

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22
project(CodeLLDB)
33
enable_testing()
44

5-
set(VERSION "1.10.1") # Base version
5+
set(VERSION "1.11.0") # Base version
66

77
include(cmake/CopyFiles.cmake)
88

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"adapter/lldb-stub",
77
"debuggee/rust",
88
]
9+
resolver = "1"
910

1011
[profile.release]
1112
debug = true

MANUAL.md

Lines changed: 75 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Starting a New Debug Session
4040

41-
To start a debugging session you will need to create a [launch configuration](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations) for your program. Here's a minimal one:
41+
To start a debugging session, you will need to create a [launch configuration](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations) for your program. Here's a minimal one:
4242

4343
```javascript
4444
{
@@ -60,7 +60,7 @@ To start a debugging session you will need to create a [launch configuration](ht
6060
|**initCommands** |[string]| LLDB commands executed upon debugger startup.
6161
|**targetCreateCommands**|[string]| LLDB commands executed to create debug target.
6262
|**preRunCommands** |[string]| LLDB commands executed just before launching/attaching the debuggee.
63-
|**processCreateCommands**|[string]| LLDB commands executed to created/attach the debuggee process.
63+
|**processCreateCommands**|[string]| LLDB commands executed to create/attach the debuggee process.
6464
|**postRunCommands** |[string]| LLDB commands executed just after launching/attaching the debuggee.
6565
|**exitCommands** |[string]| LLDB commands executed at the end of the debugging session.
6666
|**expressions** |string| The default expression evaluator type: `simple`, `python` or `native`. See [Expressions](#expressions).
@@ -85,7 +85,7 @@ These attributes are applicable when the "launch" initiation method is selected:
8585
|**env** |dictionary| Environment variables to set in addition to the ones inherited from the parent process environment (unless LLDB's `target.inherit-env` setting has been set to `false`, in which case the initial process environment is empty). You may refer to existing environment variables using `${env:NAME}` syntax. For example, in order to alter the inherited `PATH` variable, you can do this: `"PATH":"${env:HOME}/bin:${env:PATH}"`.
8686
|**envFile** |string| Path of the file to read the environment variables from. Note that `env` entries will override `envPath` entries.
8787
|**stdio** |string ❘ [string] ❘ dictionary| See [Stdio Redirection](#stdio-redirection).
88-
|**terminal** |string| Destination for debuggee stdio streams: <ul><li>`console` for DEBUG CONSOLE</li><li>`integrated` (default) for VSCode integrated terminal</li><li>`external` for a new terminal window</li></ul>
88+
|**terminal** |string| Destination for debuggee's stdio streams: <ul><li>`console` for DEBUG CONSOLE</li><li>`integrated` (default) for VSCode integrated terminal</li><li>`external` for a new terminal window</li></ul>
8989
|**stopOnEntry** |boolean| Whether to stop debuggee immediately after launching.
9090

9191
Operations performed for launch:
@@ -96,7 +96,7 @@ Operations performed for launch:
9696
- Otherwise, target is created from the binary pointed to by the `program` attribute.
9797
- Target properties are configured using `args`, `env`, `cwd`, `stdio`, etc, configuration attributes.
9898
- Breakpoints are created.
99-
- The `preRunCommands` sequence is executed. These commands may alter debug target configuration (e.g. alter args or env).
99+
- The `preRunCommands` sequence is executed. These commands may alter debug target configuration (e.g. args or env).
100100
- The debuggee process is created:
101101
- If `processCreateCommands` attribute is present, this command sequence is executed. These are expected to have created
102102
a process corresponding to the debug target.
@@ -127,7 +127,7 @@ These attributes are applicable when the "attach" initiation method is selected:
127127
|attribute |type | |
128128
|-------------------|--------|---------|
129129
|**program** |string |Path of the executable file.
130-
|**pid** |number |Process id to attach to. **pid** may be omitted, in which case debugger will attempt to locate an already running instance of the program. You may also put `${command:pickProcess}` or `${command:pickMyProcess}` here to choose a process interactively.
130+
|**pid** |number |Process id to attach to. **pid** may be omitted, in which case debugger will attempt to locate an already running instance of the program. You may also use [`${command:pickProcess}` or `${command:pickMyProcess}`](#pick-process-command) here to choose process interactively.
131131
|**stopOnEntry** |boolean |Whether to stop the debuggee immediately after attaching.
132132
|**waitFor** |boolean |Wait for the process to launch.
133133

@@ -365,7 +365,7 @@ target modules load --file ${workspaceFolder}/build/debuggee -s <base load addre
365365
Also known as [Time travel debugging](https://en.wikipedia.org/wiki/Time_travel_debugging). Provided you use a debugging backend that supports
366366
[these commands](https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#bc), CodeLLDB be used to control reverse execution and stepping.
367367
368-
As of this writing, the only backend known to work is [Mozilla's rr](https://rr-project.org/). The minimum supported version is 5.3.0.
368+
As of this writing, the only known backend that works is [Mozilla's rr](https://rr-project.org/). The minimum supported version is 5.3.0.
369369
370370
There are others mentioned [here](http://www.sourceware.org/gdb/news/reversible.html) and [here](https://github.com/mozilla/rr/wiki/Related-work).
371371
[QEMU](https://www.qemu.org/) reportedly [supports record/replay](https://github.com/qemu/qemu/blob/master/docs/replay.txt) in full system emulation mode.
@@ -406,8 +406,7 @@ Use custom launch with `target create -c <core path>` command:
406406
```
407407
408408
## Source Path Remapping
409-
Source path remapping is helpful in cases when program's source code is located in a different
410-
directory then it was in at build time (for example, if a build server was used).
409+
Source path remapping is helpful when the program's source code is located in a different directory than it was at build time (for example, if a build server was used).
411410
412411
A source map consists of pairs of "from" and "to" path prefixes. When the debugger encounters a source
413412
file path beginning with one of the "from" prefixes, it will substitute the corresponding "to" prefix
@@ -585,7 +584,7 @@ views](https://lldb.llvm.org/use/varformats.html) of the debuggee variables. Fo
585584
`std::vector` or comparing `std::string` to a string literal should "just work".
586585
587586
The followng features are supported:
588-
- References to variables: all identifiers are assumed to refer to variables in the debuggee's current stack frame.
587+
- References to variables: all identifiers are assumed to refer to variables in the debuggee current stack frame.
589588
The identifiers may be qualified with namespaces and template parameters (e.g. `std::numeric_limits<float>::digits`).
590589
- Embedded [native expressions](#native-expressions): these must be delimited with `${` and `}`.
591590
- Literals: integers, floats and strings, `True`, `False`.
@@ -627,42 +626,70 @@ thus they are often not as convenient as "simple" or "python" expressions.
627626
628627
## Debugger API
629628
630-
CodeLLDB provides extended Python API via the `debugger` module (which is auto-imported into debugger's main script context).
631-
This module exports the following functions:
632-
633-
def **evaluate(expression: `str`, unwrap=False) -> `Value` | `lldb.SBValue`** : Performs dynamic evaluation of [native expressions](#native-expressions) returning instances of [`Value`](#value).
634-
- **expression**: The expression to evaluate.
635-
- **unwrap**: Whether to unwrap the result and return it as `lldb.SBValue`.
636-
637-
**unwrap(obj: `Value`) -> `lldb.SBValue`** : Extracts an [`lldb.SBValue`](https://lldb.llvm.org/python_api/lldb.SBValue.html) from [`Value`](#value).
638-
639-
**wrap(obj: `lldb.SBValue`) -> `Value`** : Wraps [`lldb.SBValue`](https://lldb.llvm.org/python_api/lldb.SBValue.html) in a [`Value`](#value) object.
640-
641-
**create_webview(html: `str`=None, title: `str`=None, view_column: `int`=None, preserve_focus: `bool`=False, enable_find_widget: `bool`=False, retain_context_when_hidden: `bool`=False, enable_scripts: `bool`=False) -> Webview** :
642-
Create a [Webview](#webview), which can be used to display HTML content in VSCode UI.
643-
644-
**display_html(html: `str`, title: `str` = None, position: `int` = None, reveal: `bool` = False)** : (deprecated - use webviews instead) Displays content in a VSCode Webview panel:
645-
- **html**: HTML markup to display.
646-
- **title**: Title of the panel. Defaults to the name of the current launch configuration.
647-
- **position**: Position (column) of the panel. The allowed range is 1 through 3.
648-
- **reveal**: Whether to reveal the panel if one already exists.
629+
CodeLLDB provides extended Python API via the `codelldb` module (also aliased as `debugger`),
630+
which is auto-imported into debugger's main script context:
631+
632+
```python
633+
# codelldb
634+
635+
def get_config(name: str, default: Any = None) -> Any:
636+
'''Retrieve a configuration value from the adapter settings.
637+
name: Dot-separated path of the setting to retrieve. For example, 'foo.bar', will retrieve the value of `lldb.script.foo.bar`.
638+
default: The default value to return if the configuration value is not found.
639+
'''
640+
def evaluate(expr: str, unwrap: bool = False) -> Value | lldb.SBValue:
641+
'''Performs dynamic evaluation of native expressions returning instances of Value or SBValue.
642+
expression: The expression to evaluate.
643+
unwrap: Whether to unwrap the result and return it as lldb.SBValue
644+
'''
645+
def wrap(obj: lldb.SBValue) -> Value:
646+
'''Extracts an lldb.SBValue from Value'''
647+
def unwrap(obj: Value) -> lldb.SBValue:
648+
'''Wraps lldb.SBValue in a Value object'''
649+
def create_webview(html: Optional[str] = None, title: Optional[str] = None, view_column: Optional[int] = None,
650+
preserve_focus: bool = False, enable_find_widget: bool = False,
651+
retain_context_when_hidden: bool = False, enable_scripts: bool = False):
652+
'''Create a webview panel.
653+
html: HTML content to display in the webview. May be later replaced via Webview.set_html().
654+
title: Panel title.
655+
view_column: Column in which to show the webview.
656+
preserve_focus: Whether to preserve focus in the current editor when revealing the webview.
657+
enable_find_widget: Controls if the find widget is enabled in the panel.
658+
retain_context_when_hidden: Controls if the webview panel retains its context when it is hidden.
659+
enable_scripts: Controls if scripts are enabled in the webview.
660+
'''
661+
```
649662
650663
## Webview
651-
The Webview class provides a simplified interface to VSCode [Webview](https://code.visualstudio.com/api/references/vscode-api#WebviewPanel).
652-
653-
class **Webview:**
654-
- **set_html(html: `str`)**: Set HTML contents of the webview.
655-
- **reveal(view_column: `int`=None, preserve_focus: `bool`=False)**: Show the webview panel in a given column.
656-
- **post_message(message: `object`)**: Post a message to the webview content.
657-
- **dispose()**: Destroy the webview panel
658-
- **on_did_receive_message: `Event[object]`**: Fired when the webview content posts a message.
659-
- **on_did_dispose: `Event`**: Fired when the webview panel is disposed (either by the user or by calling dispose()).
664+
A simplified interface for [webview panels](https://code.visualstudio.com/api/references/vscode-api#WebviewPanel).
665+
666+
```python
667+
class Webview:
668+
def dispose(self):
669+
'''Destroy webview panel.'''
670+
def set_html(self, html: str):
671+
'''Set HTML contents of the webview.'''
672+
def reveal(self, view_column: Optional[int] = None, preserve_focus: bool = False):
673+
'''Show the webview panel in a given column.'''
674+
def post_message(self, message: Any):
675+
'''Post a message to the webview content.'''
676+
interface.send_message(dict(message='webviewPostMessage', id=self.id, inner=message))
677+
@property
678+
def on_did_receive_message(self) -> Event:
679+
'''Fired when webview content posts a new message.'''
680+
@property
681+
def on_did_dispose(self) -> Event:
682+
'''Fired when the webview panel is disposed (either by the user or by calling dispose())'''
683+
```
660684
661685
## Event
662-
class **Event[T]:**
663-
- **add(handler: `Callable[T]`)**: Add event listener.
664-
- **remove(handler: `Callable[T]`)**: Remove event listener.
665-
686+
```python
687+
class Event:
688+
def add(self, listener: Callable[[Any]]):
689+
'''Add an event listener.'''
690+
def remove(self, listener: Callable[[Any]]):
691+
'''Remove an event listener.'''
692+
```
666693
667694
## Value
668695
`Value` objects ([source](adapter/scripts/codelldb/value.py)) are proxy wrappers around [`lldb.SBValue`](https://lldb.llvm.org/python_api/lldb.SBValue.html),
@@ -700,19 +727,18 @@ this configuration entry: `"lldb.adapterEnv": {"LLDB_DEBUGSERVER_PATH": "<lldb-s
700727
701728
# Rust Language Support
702729
703-
CodeLLDB natively supports visualization of most common Rust data types:
704-
- Built-in types: tuples, enums, arrays, array and string slices.
705-
- Standard library types: `Vec`, `String`, `CString`, `OSString`, `Path`, `Cell`, `Rc`, `Arc` and more.
730+
CodeLLDB will attempt to locate and load LLDB data formatters provided by the Rust toolchain. By default, the configured
731+
toolchain of your workspace root will be used, however this can be overridden via these configuration settings:
732+
- **lldb.script.lang.rust.toolchain** - override toolchain name, for example `beta`.
733+
- **lldb.script.lang.rust.sysroot** - set toolchain sysroot directly, for example `/home/user/.rustup/toolchains/beta-x86_64-unknown-linux-gnu`.
706734
707735
To enable this feature, add `"sourceLanguages": ["rust"]` into your launch configuration.
708736
709-
![source](images/source.png)
710-
711737
## Cargo support
712738
713739
Several Rust users had pointed out that debugging tests and benchmarks in Cargo-based projects is somewhat
714740
difficult since names of the output test/bench binary generated by Cargo is not deterministic.
715-
To cope with this problem, CodeLLDB can query Cargo for a list of its compilation outputs. In order
741+
To address this problem, CodeLLDB can query Cargo for a list of its compilation outputs. In order
716742
to use this feature, replace `program` property in your launch configuration with `cargo`:
717743
```javascript
718744
{
@@ -805,6 +831,8 @@ These settings specify the default values for launch configuration setting of th
805831
|**lldb.dereferencePointers** |Whether to show summaries of the pointees instead of numeric values of the pointers themselves.
806832
|**lldb.suppressMissingSourceFiles**|Suppress VSCode's messages about missing source files (when debug info refers to files not available on the local machine).
807833
|**lldb.consoleMode** |Controls whether the DEBUG CONSOLE input is by default treated as debugger commands or as expressions to evaluate:<li>`commands` - treat debug console input as debugger commands. In order to evaluate an expression, prefix it with '?' (question mark).",<li>`evaluate` - treat DEBUG CONSOLE input as expressions. In order to execute a debugger command, prefix it with '/cmd ' or '\`' (backtick), <li>`split` - (experimental) use the DEBUG CONSOLE for evaluation of expressions, open a separate terminal for LLDB console.
834+
|**lldb.script** |Configuration settings provided to Python scripts running in the context of CodeLLDB. These may be read via [`get_config()`](#debugger-api).
835+
808836
809837
## Advanced
810838
| | |

0 commit comments

Comments
 (0)