使用 GDB 在 vscode 中设置汇编代码断点

问题描述 投票:0回答:1

我使用 xUbuntu 22.04.4 和 linux 的 vscode 当前版本(1.87.2)

我想设置 .s 程序集 (AT&T) 文件的调试。我创建了一个 task.json 和一个 launch.json 文件,并在设置中允许在任何地方使用断点。

但是当我启动调试时,它正在工作,但没有考虑断点。我可以在 task.json 和 launch.json 文件中更改哪些内容(请参阅下面的代码)?

启动.json

    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Program",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

任务.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "gcc",
            "args": [
                "-nostdlib",   // Ne pas utiliser la bibliothèque standard
                "-o",          // Spécifie le nom du fichier de sortie
                "${fileDirname}/${fileBasenameNoExtension}",     // Nom du fichier de sortie
                "${fileDirname}/${fileBasenameNoExtension}.s" // Chemin vers le fichier source
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": {
                "pattern": {
                  "regexp": "error"
                }
              },
            "presentation": {
                "reveal": "silent",
                "panel": "dedicated",
                "focus": true,
                "clear": true
              }
        }
    ]
}

visual-studio-code assembly gdb x86-64 att
1个回答
0
投票

我发现我错过了task.json文件中“args”键中的参数“-g”:

       "args": [
                "-g", 
                "-nostdlib", // ....

为了制作调试信息

© www.soinside.com 2019 - 2024. All rights reserved.