Skip to content

Process stops when log message and condition are both set #1146

@msmans

Description

@msmans

Environment data

  • debugpy version: 1.6.4
  • OS and version: ArchLinux 6.1.0-rc8-1-mainline
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.10.8
  • Using VS Code or Visual Studio: VS Code 1.73.1 6261075646f055b99068d3688932416f2346dd3b x64

Actual behavior

When setting a log point with a condition, the log message is printed when the line is hit, but the debugger also stops the process.

Expected behavior

If log message is set, process must not be stopped (per Debugger Adapter Protocol spec):

If this attribute (ie logMessage) exists and is non-empty, the debug adapter must not 'break' (stop) but log the message instead.

The spec does not make an exception to this when conditon or hit count is specified.

Steps to reproduce:

  1. Open any python project.
  2. Right click the red dot on any line and select to Log Message.
  3. Enter an expression to log.
  4. Add condition as well.
  5. Start debugger.

Some DAP protocol logs:

{"command":"setBreakpoints","arguments":{"source":{"path":"/home/bob/file.py","sourceReference":0},"lines":[120],"breakpoints":[{"line":120,"condition":"{request.GET.get('id') == 1}","logMessage":"ID is set!"}],"sourceModified":false},"type":"request","seq":131}

{"seq": 293, "type": "response", "request_seq": 131, "success": true, "command": "setBreakpoints", "body": {"breakpoints": [{"verified": true, "id": 20, "source": {"path": "/home/bob/file.py", "sourceReference": 0}, "line": 120}]}}

{"seq": 296, "type": "event", "event": "output", "body": {"output": "ID is set!\n", "category": "stdout", "source": {}}}

{"seq": 297, "type": "event", "event": "stopped", "body": {"reason": "breakpoint", "threadId": 211, "preserveFocusHint": false, "allThreadsStopped": true}}

Notice the last stopped event which should not be there.

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