|
5 | 5 | "name": "Make: compile and debug",
|
6 | 6 | "type": "cppdbg",
|
7 | 7 | "request": "launch",
|
8 |
| - "program": "${workspaceFolder}/${config:c_project.dir}/${config:c_project.program}", |
| 8 | + "program": "/bin/bash", |
9 | 9 | "args": [
|
10 |
| - "${config:c_project.arg1}", |
11 |
| - "${config:c_project.arg2}", |
12 |
| - "${config:c_project.arg3}", |
13 |
| - "${config:c_project.arg4}", |
14 |
| - "${config:c_project.arg5}", |
15 |
| - "${config:c_project.arg6}", |
16 |
| - "${config:c_project.arg7}", |
17 |
| - "${config:c_project.arg8}" |
| 10 | + "-c", |
| 11 | + "${workspaceFolder}/.vscode/run.sh", |
18 | 12 | ],
|
19 |
| - "stopAtEntry": true, |
| 13 | + "stopAtEntry": false, |
20 | 14 | "cwd": "${workspaceFolder}/${config:c_project.dir}",
|
21 | 15 | "externalConsole": false,
|
22 | 16 | "linux": {
|
23 | 17 | "MIMode": "gdb",
|
24 | 18 | "internalConsoleOptions": "neverOpen", // don't show the debugger console
|
25 | 19 | "environment": [
|
26 | 20 | {"name":"LD_PRELOAD", "value":"${workspaceFolder}/.vscode/visualize-c-memory.so"},
|
| 21 | + {"name":"CODE_DEBUG", "value":"./${config:c_project.program} ${config:c_project.args}"}, |
27 | 22 | ],
|
28 | 23 | "setupCommands": [
|
29 | 24 | {
|
|
39 | 34 | },
|
40 | 35 | "osx": {
|
41 | 36 | "MIMode": "lldb", // on macOS gdb is hard to setup
|
42 |
| - "internalConsoleOptions": "openOnSessionStart" // open the debugger console, lldb sends output only there |
| 37 | + "internalConsoleOptions": "openOnSessionStart", // open the debugger console, lldb sends output only there |
| 38 | + "environment": [ |
| 39 | + {"name":"CODE_DEBUG", "value":"./${config:c_project.program} ${config:c_project.args}"}, |
| 40 | + ], |
| 41 | + "setupCommands": [ |
| 42 | + { |
| 43 | + "description": "Don't stop on exec", // lldb stops execution on "exec", we need to continue since we run via bash |
| 44 | + "text": "settings set target.process.stop-on-exec false", |
| 45 | + "ignoreFailures": false |
| 46 | + } |
| 47 | + ], |
43 | 48 | },
|
44 | 49 | "preLaunchTask": "Make: compile",
|
45 | 50 | },
|
46 | 51 | {
|
47 | 52 | "name": "Single file: compile and debug",
|
48 | 53 | "type": "cppdbg",
|
49 | 54 | "request": "launch",
|
50 |
| - "program": "${fileDirname}/${fileBasenameNoExtension}", |
| 55 | + "program": "/bin/bash", |
51 | 56 | "args": [
|
52 |
| - "${config:c_project.arg1}", |
53 |
| - "${config:c_project.arg2}", |
54 |
| - "${config:c_project.arg3}", |
55 |
| - "${config:c_project.arg4}", |
56 |
| - "${config:c_project.arg5}", |
57 |
| - "${config:c_project.arg6}", |
58 |
| - "${config:c_project.arg7}", |
59 |
| - "${config:c_project.arg8}" |
| 57 | + "-c", |
| 58 | + "${workspaceFolder}/.vscode/run.sh", |
60 | 59 | ],
|
61 |
| - "stopAtEntry": true, |
| 60 | + "stopAtEntry": false, |
62 | 61 | "cwd": "${fileDirname}",
|
63 | 62 | "environment": [],
|
64 | 63 | "externalConsole": false,
|
|
67 | 66 | "internalConsoleOptions": "neverOpen", // don't show the debugger console
|
68 | 67 | "environment": [
|
69 | 68 | {"name":"LD_PRELOAD", "value":"${workspaceFolder}/.vscode/visualize-c-memory.so"},
|
| 69 | + {"name":"CODE_DEBUG", "value":"./${fileBasenameNoExtension} ${config:c_project.args}"}, |
70 | 70 | ],
|
71 | 71 | "setupCommands": [
|
72 | 72 | {
|
|
82 | 82 | },
|
83 | 83 | "osx": {
|
84 | 84 | "MIMode": "lldb", // on macOS gdb is hard to setup
|
85 |
| - "internalConsoleOptions": "openOnSessionStart" // open the debugger console, lldb sends output only there |
| 85 | + "internalConsoleOptions": "openOnSessionStart", // open the debugger console, lldb sends output only there |
| 86 | + "environment": [ |
| 87 | + {"name":"CODE_DEBUG", "value":"./${fileBasenameNoExtension} ${config:c_project.args}"}, |
| 88 | + ], |
| 89 | + "setupCommands": [ |
| 90 | + { |
| 91 | + "description": "Don't stop on exec", // lldb stops execution on "exec", we need to continue since we run via bash |
| 92 | + "text": "settings set target.process.stop-on-exec false", |
| 93 | + "ignoreFailures": false |
| 94 | + } |
| 95 | + ], |
86 | 96 | },
|
87 | 97 | "preLaunchTask": "Single file: compile",
|
88 | 98 | },
|
89 | 99 | {
|
90 | 100 | "name": "All files in directory: compile and debug",
|
91 | 101 | "type": "cppdbg",
|
92 | 102 | "request": "launch",
|
93 |
| - "program": "${fileDirname}/${config:c_project.program}", |
| 103 | + "program": "/bin/bash", |
94 | 104 | "args": [
|
95 |
| - "${config:c_project.arg1}", |
96 |
| - "${config:c_project.arg2}", |
97 |
| - "${config:c_project.arg3}", |
98 |
| - "${config:c_project.arg4}", |
99 |
| - "${config:c_project.arg5}", |
100 |
| - "${config:c_project.arg6}", |
101 |
| - "${config:c_project.arg7}", |
102 |
| - "${config:c_project.arg8}" |
| 105 | + "-c", |
| 106 | + "${workspaceFolder}/.vscode/run.sh", |
103 | 107 | ],
|
104 |
| - "stopAtEntry": true, |
| 108 | + "stopAtEntry": false, |
105 | 109 | "cwd": "${fileDirname}",
|
106 | 110 | "environment": [],
|
107 | 111 | "externalConsole": false,
|
|
110 | 114 | "internalConsoleOptions": "neverOpen", // don't show the debugger console
|
111 | 115 | "environment": [
|
112 | 116 | {"name":"LD_PRELOAD", "value":"${workspaceFolder}/.vscode/visualize-c-memory.so"},
|
| 117 | + {"name":"CODE_DEBUG", "value":"./${config:c_project.program} ${config:c_project.args}"}, |
113 | 118 | ],
|
114 | 119 | "setupCommands": [
|
115 | 120 | {
|
|
125 | 130 | },
|
126 | 131 | "osx": {
|
127 | 132 | "MIMode": "lldb", // on macOS gdb is hard to setup
|
128 |
| - "internalConsoleOptions": "openOnSessionStart" // open the debugger console, lldb sends output only there |
| 133 | + "internalConsoleOptions": "openOnSessionStart", // open the debugger console, lldb sends output only there |
| 134 | + "environment": [ |
| 135 | + {"name":"CODE_DEBUG", "value":"./${config:c_project.program} ${config:c_project.args}"}, |
| 136 | + ], |
| 137 | + "setupCommands": [ |
| 138 | + { |
| 139 | + "description": "Don't stop on exec", // lldb stops execution on "exec", we need to continue since we run via bash |
| 140 | + "text": "settings set target.process.stop-on-exec false", |
| 141 | + "ignoreFailures": false |
| 142 | + } |
| 143 | + ], |
129 | 144 | },
|
130 |
| - "setupCommands": [ |
131 |
| - { |
132 |
| - "description": "Enable pretty-printing for gdb", |
133 |
| - "text": "-enable-pretty-printing", |
134 |
| - "ignoreFailures": true |
135 |
| - } |
136 |
| - ], |
137 | 145 | "preLaunchTask": "All files in directory: compile",
|
138 | 146 | },
|
139 | 147 | ]
|
|
0 commit comments