Skip to content

How to debug qemu vm with vscode #3185

@voidif

Description

@voidif

Hello all,
I try to use vscode to debug programs, launched in QEMU, which has a gdbserver at port 1234

In my bash cmd windows, I can simply type gdb -x inittmp.gdb -s kernel/weenix.dbg -x commands.gdb -x init.gdb, then it goes into gdb. But I can not do this in vscode.

Form the issue #2713, It looks I can not ignore "program" paras, so I set it to "path to weenix.dbg", which is my symbol file.

And I add miDebuggerServerAddress paras so I can successfully start gdb.

But in this case, it looks like it did not exec the args(-x inittmp.gdb -s kernel/weenix.dbg -x commands.gdb -x init.gdb).

Any suggestions?
Thanks!

Here is my launch.json:
{
"name": "(gdb) Remote Launch",
"type": "cppdbg",
"request": "launch",
"miDebuggerServerAddress": "127.0.0.1:1234",
"program": "/home/user/Desktop/HW3/weenix-assignment-3.2.0/weenix/kernel/weenix.dbg",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"sourceFileMap": {
"/build": "/build"
},
"logging": {
"engineLogging": false
},
// "miDebuggerPath": "/home/user/Desktop/HW3/weenix-assignment-3.2.0/gdb.sh",
"MIMode": "gdb",
"miDebuggerArgs": "-x inittmp.gdb -s kernel/weenix.dbg -x commands.gdb -x init.gdb",
// "launchCompleteCommand": "exec-continue",
// "setupCommands": [
// {
// "description": "Enable pretty-printing for gdb",
// "text": "-x inittmp.gdb -s kernel/weenix.dbg -x commands.gdb -x init.gdb",
// "ignoreFailures": true
// }
// ]
}

  • OS and Version: Ubuntu 16.04 32bit
  • VS Code Version: 1.25.1
  • C/C++ Extension Version: 0.20.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions