Skip to content

sometimes cppdbg report an error and quit when run on a break point #13198

Open
@steven-citops

Description

@steven-citops

Environment

  • OS and version: ubuntu x64 24.04
  • VS Code: 1.96.4
  • C/C++ extension: 1.23.4
  • OS and version of remote machine (if applicable): linux 4.9 on arm 32bit cortex-A9
  • GDB / LLDB version: gdb 7.12

Bug Summary and Steps to Reproduce

Bug Summary:
I run vs code on ubuntu 24.04 with a cross compiled gdb 7.12, to remote debug a program run on another embeded device( cpu is arm cortex-A9 32bit), a gdb server 7.12 run on device to execute the program, sometimes, cppdbg failed to enter an common break point, it report an error message: "ERROR: Error while trying to enter break state. Debugging will now stop. Unrecognized format of field "level" in result: {level=-1,addr=0x7603e3ac,func=??,args=[]}"
but when I use codeblock 20.03 with the same cross compiled gdb 7.12, that is ok to enter the same break point.

Steps to reproduce:

  1. In this environment...
  2. With this config...
  3. Do '...'
  4. See error...

Debugger Configurations

lauhcn.json
{
    "configurations": [
        {
            "name": "Remote GDB Debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/mdvr_mqtt",
            "args": [],
            "miDebuggerPath": "/opt/arm-ca9-linux-gnueabihf-6.5/bin/arm-ca9-linux-gnueabihf-gdb",  // 交叉GDB的路径,如 arm-none-eabi-gdb
            "miDebuggerArgs":"-nx -fullname -quiet",    // -nx: do not use init, -fullname: not stardard. -quiet: no gdb version info output
            //"stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false, // 是否使用外部控制台
            "MIMode": "gdb",
            "targetArchitecture": "arm",
            
            "miDebuggerServerAddress": "192.168.1.175:7720",
            "serverStarted": "Remote debugging from host 192.168.1.240",    // 通过搜索std output文本,取回输出信息在Debug Console显示
            "setupCommands": [
                 // 在这里添加你需要执行的其他GDB命令
                {
                    "description": "Set system root path",
                    "text": "set sysroot /home/gdb-sysroot/ca9/sysroot", // 替换为你的系统根路径
                    "ignoreFailures": false
                },
                // {
                //     "description": "delete old program",
                //     "text": "extended-remote delete /var/disk3/gdbca9/mdvr_mqtt",
                //     "ignoreFailures": false
                // },
                // {
                //     "description": "put file",
                //     "text": "extended-remote put '${workspaceFolder}/mdvr_mqtt' /var/disk3/gdbca9/mdvr_mqtt",                   
                //     "ignoreFailures": false
                // },
                {
                    "description": "set file",
                    "text": "set remote exec-file /mnt/user/test/mdvr_mqtt",                   
                    "ignoreFailures": false
                },
                {
                    "description": "Set a breakpoint at main",
                    "text": "break main",
                    "ignoreFailures": false
                },
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            //"postLaunchTask": "", // 可选,调试启动后的任务(如编译)
            //"preLaunchTask": "build", // 可选,调试启动前的任务(如编译)
            "logging": {
                "trace": false,
                "traceResponse": false,
                "engineLogging": false,
                "programOutput": true,
                "exceptions": true
            }
        },
        {
            "name": "C/C++: Novatek CA9 G++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            //"preLaunchTask": "C/C++: Novatek CA9 G++ build active file",
            "miDebuggerPath": "/opt/arm-ca9-linux-gnueabihf-6.5/bin/arm-ca9-linux-gnueabihf-gdb"
        }
    ],
    "version": "2.0.0"
}
tasks.json:
{
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "make",
            "args": [
                "-C",
                "${workspaceFolder}", // 指定工作目录为项目根目录"
                "-f",
                "Makefile.mqtt",
                "-j4",
                "-s"
            ],
            "options": {
                "cwd": "${workspaceFolder}",
                "env": {
                    "PATH": "/opt/arm-ca9-linux-gnueabihf-6.5/bin:${env:PATH}"
                },
            },
            "presentation": {
                "echo": true,    // 是否在终端中回显命令
                "reveal": "always", // 何时在终端中显示输出
                "focus": true,  // 是否在任务开始时聚焦终端
                "panel": "shared" // 输出面板的共享行为
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "make a build"
        },
        {
            "label": "clean",
            "type": "shell",
            "command": "make",
            "args": [
                "-f",
                "Makefile.mqtt",
                "clean"
            ],
            "options": {
                "cwd": "${workspaceFolder}",
                "env": {
                    "PATH": "/opt/arm-ca9-linux-gnueabihf-6.5/bin:${env:PATH}"
                },
            },
            "presentation": {
                "echo": true,    // 是否在终端中回显命令
                "reveal": "always", // 何时在终端中显示输出
                "focus": true,  // 是否在任务开始时聚焦终端
                "panel": "shared" // 输出面板的共享行为
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "make clean"    
        },
        {
            "label": "clean-and-build",
            "type": "shell",
            "dependsOn": [
                "clean",
                "build"
            ],
            "options": {
                //"cwd": "${fileDirname}",
                "env": {
                    "PATH": "/opt/arm-ca9-linux-gnueabihf-6.5/bin:${env:PATH}"
                },
            },
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": ["$gcc"],
            "presentation": {
                "echo": true,    // 是否在终端中回显命令
                "reveal": "always", // 何时在终端中显示输出
                "focus": true,  // 是否在任务开始时聚焦终端
                "panel": "shared" // 输出面板的共享行为
            },
            "detail": "make clean, build."
        },
        {
            "label": "C/C++: compile file",
            "type": "cppbuild",
            "command": "/opt/arm-ca9-linux-gnueabihf-6.5/bin/arm-ca9-linux-gnueabihf-g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${workspaceFolder}",
                "env": {
                    "PATH": "/opt/arm-ca9-linux-gnueabihf-6.5/bin:${env:PATH}"
                },
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Debugger Logs

ERROR: Error while trying to enter break state. Debugging will now stop. Unrecognized format of field "level" in result: {level=-1,addr=0x7603e3ac,func=??,args=[]}

Other Extensions

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebuggerhelp wantedCan be fixed in the public (open source) repo.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions