代码之家  ›  专栏  ›  技术社区  ›  Damian

切换断点在Visual Studio代码中不起作用

  •  0
  • Damian  · 技术社区  · 7 年前

    当我试图设置断点时,什么也没有发生;我把光标放在屏幕上 println! 线和压力机 F9

    fn main() {
        println!("Hello, world!");
    }
    

    我在另一台安装了Visual Studio 2017的机器上工作,因此我怀疑这可能是问题所在。

    任务。json

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "build",
                "type": "shell",
                "command": "cargo build",
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "presentation": {
                    "panel": "dedicated",
                    "clear": true
                },
                "problemMatcher": {
                    "owner": "rust",
                    "fileLocation": [
                        "relative",
                        "${workspaceRoot}"
                    ],
                    "pattern": {
                        "regexp": "^(.+):(\\d+):(\\d+):\\s+(\\d+):(\\d+)\\s+(warning|error):\\s+(.*)$",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "endLine": 4,
                        "endColumn": 5,
                        "severity": 6,
                        "message": 7
                    }
                }
            },
            {
                "label": "clean",
                "type": "shell",
                "command": "cargo clean"
            },
            {
                "label": "run",
                "type": "shell",
                "command": "cargo run",
                "presentation": {
                    "panel": "dedicated",
                    "clear": true
                },
                "problemMatcher": []
            },
            {
                "label": "test",
                "type": "shell",
                "command": "cargo test",
                "group": {
                    "kind": "test",
                    "isDefault": true
                },
                "presentation": {
                    "panel": "dedicated",
                    "clear": true
                },
                "problemMatcher": [
                    {
                        "owner": "rust",
                        "fileLocation": [
                            "relative",
                            "${workspaceRoot}"
                        ],
                        "pattern": {
                            "regexp": "^(.+):(\\d+):(\\d+):\\s+(\\d+):(\\d+)\\s+(warning|error):\\s+(.*)$",
                            "file": 1,
                            "line": 2,
                            "column": 3,
                            "endLine": 4,
                            "endColumn": 5,
                            "severity": 6,
                            "message": 7
                        }
                    },
                    {
                        "owner": "rust",
                        "fileLocation": [
                            "relative",
                            "${workspaceRoot}"
                        ],
                        "severity": "error",
                        "pattern": {
                            "regexp": "^.*panicked\\s+at\\s+'(.*)',\\s+(.*):(\\d+)$",
                            "message": 1,
                            "file": 2,
                            "line": 3
                        }
                    }
                ]
            }
        ]
    }
    

    发射json

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(Windows) Launch",
                "type": "cppvsdbg",
                "request": "launch",
                "program": "${workspaceFolder}/target/debug/${workspaceRootFolderName}",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}/target/debug/",
                "environment": [],
                "externalConsole": true,
            },       
        ]
    }
    

    我已安装Visual Studio 2019:

    >cl --version   
    Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    

    1. C/C++0.22.1
    2. 锈蚀(rls)0.6.0

    我使用的是Rust 1.33.0。

    0 回复  |  直到 7 年前
        1
  •  8
  •   Tal    7 年前

    尝试将设置值“debug.allowBreakpointsEverywhere”设置为true