Skip to content

Commit bb41e83

Browse files
authored
Merge pull request #3375 from jsternberg/update-dap-docs
docs: update dap docs to reflect updates to the debugger
2 parents 31a3fbf + a7c54da commit bb41e83

File tree

2 files changed

+13
-45
lines changed

2 files changed

+13
-45
lines changed

docs/dap.md

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,72 +11,38 @@ Many [popular editors](https://microsoft.github.io/debug-adapter-protocol/implem
1111
- Pause on exception.
1212
- Set breakpoints on instructions.
1313
- Step next and continue.
14+
- Open terminal in an intermediate container image.
15+
- File explorer.
1416

1517
## Limitations
1618

17-
- **Step In** is the same as **Next**.
18-
- **Step Out** is the same as **Continue**.
19-
- **FROM** directives may have unintuitive breakpoint lines.
20-
- Stack traces may not show the full sequence of events.
19+
- The debugger cannot differentiate between identical `FROM` directives.
2120
- Invalid `args` in launch request may not produce an error in the UI.
2221
- Does not support arbitrary pausing.
2322
- Output is always the plain text printer.
23+
- File explorer does not work when pausing on an exception.
2424

2525
## Future Improvements
2626

2727
- Support for Bake.
28-
- Open terminal in an intermediate container image.
2928
- Backwards stepping.
3029
- Better UI for errors with invalid arguments.
3130

3231
## We would like feedback on
3332

34-
- Stack traces.
3533
- Step/pause locations.
3634
- Variable inspections.
3735
- Additional information that would be helpful while debugging.
38-
39-
### Stack Traces
40-
41-
We would like feedback on whether the stack traces are easy to read and useful for debugging.
42-
43-
The goal was to include the parent commands inside of a stack trace to make it easier to understand the previous commands used to reach the current step. Stack traces in normal programming languages will only have one parent (the calling function).
44-
45-
In a Dockerfile, there are no functions which makes displaying a call stack not useful. Instead, we decided to show the input to the step as the "calling function" to make it easier to see the preceding steps.
46-
47-
This method of showing a stack trace is not always clear. When a step has multiple parents, such as a `COPY --from` or a `RUN` with a bind mount, there are multiple parents. Only one can be the official "parent" in the stack trace. At the moment, we do not try to choose one and will break the stack trace into two separate call stacks. This is also the case when one step is used as the parent for multiple steps.
36+
- Annoyances or difficulties with the current implementation.
4837

4938
### Step/pause Locations
5039

51-
Execution is paused **after** the step has been executed rather than before.
52-
53-
For example:
54-
55-
```dockerfile
56-
FROM busybox
57-
RUN echo hello > /hello
58-
```
59-
60-
If you set a breakpoint on line 2, then execution will pause **after** the `RUN` has executed rather than before.
61-
62-
We thought this method would be more useful because we figured it was more common to want to inspect the state after a step rather than before the step.
63-
64-
There are also Dockerfiles where some instructions are aliases for another instruction and don't have their own representation in the Dockerfile.
65-
66-
```dockerfile
67-
FROM golang:1.24 AS golang-base
68-
69-
# Does not show up as a breakpoint since it refers to the instruction
70-
# from earlier.
71-
FROM golang-base
72-
RUN go build ...
73-
```
74-
75-
### Step into/out
40+
Execution is paused **before** the step has been executed. Due to the way Dockerfiles are written, this sometimes creates
41+
some unclear visuals regarding where the pause happened.
7642

77-
It is required to implement these for a debug adapter but we haven't determined a way that these map to Dockerfile execution. Feedback about how you would expect these to work would be helpful for future development.
43+
For the last command in a stage, step **next** will highlight the same instruction twice. One of these is before the execution and the second is after. For every other command, they are only highlighted before the command is executed. It is not currently possible to set a breakpoint at the end of a stage. You must set the breakpoint on the last step and then use step **next**.
7844

79-
For now, step into is implemented the same as next while step out is implemented the same as continue. The logic here is that next step is always going into the next call and stepping out would be returning from the current function which is the same as building the final step.
45+
When a command has multiple parents, step **into** will step into one of the parents. Step **out** will then return from that stage. This will continue until there are no additional parents. There is currently no way to tell the difference between which parents have executed and which ones have not.
8046

8147
### Variable Inspections
8248

docs/reference/buildx_dap_build.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ The following [launch request arguments](https://microsoft.github.io/debug-adapt
7575
Command line arguments may be passed to the debug adapter the same way they would be passed to the normal build command and they will set the value.
7676
Launch request arguments that are set will override command line arguments if they are present.
7777

78-
A debug extension should include an `args` entry in the launch configuration and should append these arguments to the end of the tool invocation.
78+
A debug extension should include an `args` and `builder` entry in the launch configuration. These will modify the arguments passed to the binary for the tool invocation.
79+
`builder` will add `--builder <arg>` directly after the executable and `args` will append to the end of the tool invocation.
7980
For example, a launch configuration in Visual Studio Code with the following:
8081

8182
```json
8283
{
8384
"args": ["--build-arg", "FOO=AAA"]
85+
"builder": ["mybuilder"]
8486
}
8587
```
8688

87-
This should cause the debug adapter to be invoked as `docker buildx dap build --build-arg FOO=AAA`.
89+
This should cause the debug adapter to be invoked as `docker buildx --builder mybuilder dap build --build-arg FOO=AAA`.

0 commit comments

Comments
 (0)