目录
记得在CMakefiles.txt加上---
调试c文件
- set(CMAKE_BUILD_TYPE DEBUG)
- set(CMAKE_C_FLAGS "-g")
调试c++文件
- set(CMAKE_BUILD_TYPE DEBUG)
- set(CMAKE_CXX_FLAGS "-g")
- {
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "type": "cppdbg",
- "request": "launch",
- "name": "Debug",
- "program": "/home/pc123/Public/workspace/mqtt/mqtt-demo/MQTT-C-master/MQTT-C-master/build/simple_publisher",
- "args": [],
- "cwd": "${workspaceFolder}"
- }
- ]
- }
然后直接点击调试即可,编译是cmake、make编译出来的

Hi guys,
As a workaround, you can decorate existing gdb binary with a bash script and then use it.
Steps are,
cd /usr/bin
sudo mv gdb gdborigNow you need to create a bash script named gdb with following content.
sudo vim gdbContent of the bash is;
#!/bin/shsudo gdborig $@Finally, make the script runnable.
sudo chmod 0755 gdbThen you should be OK.