vscode代码调试配置

C/C++代码调试

点击 vscode左侧的 run and debug,新建launch.json 和 tasks.json,并进行配置如下

launch.json

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

 

{

// 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": [

{

"name": "(gdb) Launch",

"type": "cppdbg",

"request": "launch",

"program": "${workspaceFolder}/build/HelloWorld",

"args": [],

"stopAtEntry": false,

"cwd": "${fileDirname}",

"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": "build",

"miDebuggerPath": "/home/sietium/rocm/gdb"

}

]

}

tasks.json

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

 

{

"version" : "2.0.0",

"tasks": [

{

"type": "shell",

"label": "mkdirbuild",

"command": "mkdir",

"options": {

"cwd": "${workspaceFolder}"

},

"args": ["-p", "build"],

},

{

"type": "shell",

"label": "cmake",

"command": "cmake",

"options": {

"cwd": "${workspaceFolder}/build"

},

"args": [

"-DCMAKE_BUILD_TYPE=Debug",

".."

],

"dependsOn" : [

"mkdirbuild"

]

},

{

"type": "shell",

"label": "make",

"group": {

"kind": "build",

"isDefault": true

},

"command": "make",

"args": ["-j",],

"options": {

"cwd": "${workspaceFolder}/build"

},

"dependsOn" : [

"cmake"

]

},

{

"label": "build",

"dependsOrder": "sequence",

"dependsOn" : ["cmake", "make"]

},

],

}

你可能感兴趣的:(编程语言,vscode,c++,C,c语言)