зеркало из https://github.com/microsoft/CCF.git
Integrate with VS Code debugging (#1444)
This commit is contained in:
Родитель
dbff495a03
Коммит
bb3ed4f361
|
@ -3,7 +3,8 @@ _build/
|
|||
Debug*/
|
||||
Release*/
|
||||
CMakeFiles/
|
||||
.vscode/
|
||||
.vscode/*
|
||||
!.vscode/launch.json
|
||||
.vs/
|
||||
libuv/
|
||||
raft_tests.md
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"inputs": [{
|
||||
"id": "node",
|
||||
"default": "0",
|
||||
"description": "Choose the node to debug (must be enabled with -d <n>)",
|
||||
"options": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
|
||||
"type": "pickString"
|
||||
}],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug node",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/bin/bash",
|
||||
"args": ["${workspaceFolder}/build/vscode-gdb.sh", "${input:node}"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Follow fork",
|
||||
"text": "set follow-fork-mode child",
|
||||
"ignoreFailures": false
|
||||
},
|
||||
{
|
||||
"description": "Ignore SIGILL",
|
||||
"text": "handle SIGILL nostop",
|
||||
"ignoreFailures": false
|
||||
},
|
||||
{
|
||||
"description": "Enable pretty-printing",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -122,6 +122,10 @@ class Network:
|
|||
self.dbg_nodes = dbg_nodes
|
||||
self.perf_nodes = perf_nodes
|
||||
|
||||
try:
|
||||
os.remove(os.path.join(self.binary_dir, "vscode-gdb.sh"))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
for host in hosts:
|
||||
self.create_node(host)
|
||||
|
||||
|
|
|
@ -167,6 +167,12 @@ class Node:
|
|||
self.remote.setup()
|
||||
self.network_state = NodeNetworkState.started
|
||||
if self.debug:
|
||||
with open(os.path.join(self.binary_dir, "vscode-gdb.sh"), "a") as f:
|
||||
f.write(f"if [ $1 -eq {self.remote.local_node_id} ]; then\n")
|
||||
f.write(f"cd {self.remote.remote.root}\n")
|
||||
f.write(f"{' '.join(self.remote.remote.cmd)}\n")
|
||||
f.write("fi\n")
|
||||
|
||||
print("")
|
||||
phost = "localhost" if self.host.startswith("127.") else self.host
|
||||
print(
|
||||
|
|
Загрузка…
Ссылка в новой задаче