Skip to content

Debugger stops on the wrong line if they share the source image and the same instruction #3482

@rcjsuen

Description

@rcjsuen
github.com/docker/buildx v0.29.1-desktop.1 28f6246ff24e2c05095e8741e48c48dcb2d3b4bc
  1. Put a breakpoint on line 4.
  2. Start the debugger.
  3. It stops on line 2. :(
FROM alpine:3.22 AS source
RUN echo "Hello world"
FROM alpine:3.22
RUN echo "Hello world"
COPY --from=source . .
  1. setBreakpoints request and response looks good.
  2. breakpoint event says the breakpoint is on line 4.
  3. stackTrace response says we're stopped on line 2.
{
    "command": "setBreakpoints",
    "arguments": {
        "source": {
            "name": "Dockerfile",
            "path": "/tmp/buildx-debugging-demo/Dockerfile"
        },
        "lines": [
            4
        ],
        "breakpoints": [
            {
                "line": 4
            }
        ],
        "sourceModified": false
    },
    "type": "request",
    "seq": 3
}
{
    "seq": 4,
    "type": "response",
    "request_seq": 3,
    "success": true,
    "command": "setBreakpoints",
    "body": {
        "breakpoints": [
            {
                "id": 1,
                "verified": false,
                "line": 4,
                "endLine": 4
            }
        ]
    }
}
{
    "seq": 9,
    "type": "event",
    "event": "breakpoint",
    "body": {
        "reason": "changed",
        "breakpoint": {
            "id": 1,
            "verified": true,
            "line": 4,
            "endLine": 4
        }
    }
}
{
    "seq": 10,
    "type": "event",
    "event": "stopped",
    "body": {
        "reason": "breakpoint",
        "description": "Paused on breakpoint",
        "threadId": 1,
        "hitBreakpointIds": [
            1
        ]
    }
}
{
    "command": "threads",
    "type": "request",
    "seq": 6
}
{
    "seq": 11,
    "type": "response",
    "request_seq": 6,
    "success": true,
    "command": "threads",
    "body": {
        "threads": [
            {
                "id": 1,
                "name": "default"
            }
        ]
    }
}
{
    "command": "stackTrace",
    "arguments": {
        "threadId": 1,
        "startFrame": 0,
        "levels": 20
    },
    "type": "request",
    "seq": 7
}
{
    "seq": 12,
    "type": "response",
    "request_seq": 7,
    "success": true,
    "command": "stackTrace",
    "body": {
        "stackFrames": [
            {
                "id": 3,
                "name": "[source 2/2] RUN echo \"Hello world\"",
                "source": {
                    "name": "Dockerfile",
                    "path": "/tmp/buildx-debugging-demo/Dockerfile"
                },
                "line": 2,
                "column": 0,
                "endLine": 2
            }
        ]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions