Stepping multi-threaded C program with VSCode's debugger switches thread on every step.
The thread where debugger jumps runs code like this:
do {
rc = nanosleep(&rqtp, &rem);
rqtp = rem;
} while (rc < 0 && errno == EINTR);
My debugger configuration is as follows: "version": "0.2.0", "configurations": [
{
"name": "solid Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/program",
"args": ["-a","-b"],
"stopAtEntry": true,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
}
Q1:How do I get debugger to stick with the thread which ran into breakpoint?
Q2:How do I keep the focus on callstack belonging to that thread?