You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C/C++ Extension Version: Version 0.30.0-insiders4: September 1, 2020
Other extensions you installed (and if the issue persists after disabling them):
A clear and concise description of what the bug is:
I want to step into the function pthread_create.c of external library pthread.
ERROR:
Unable to open 'pthread_create.c': Unable to read file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c').
To Reproduce Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
create test file petersonAlgorithm.c
2.Build
set breakpoints at pthread_create(&p1,NULL,func,(void*)0
Debug See error :
Unable to open 'pthread_create.c': Unable to read file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c').
Additional context test file petersonAlgorithm.c Code:
#include <stdio.h>
#include <pthread.h>
int flag[2];
int turn;
const int MAX = 1e9;
int ans = 0;
void lock_init()
{
flag[0] = flag[1]=0;
turn = 0;
}
void lock(int self)
{
flag[self] = 1;//lock
turn = 1-self;// first give the other thread the chance to
// acquire lock
while(flag[1-self]==1 && turn == 1-self);// exit until
}
void unlock(int self)
{
flag[self] =0;
}
void* func(void *s)
{
int i=0;
int self = (int*)s;
printf("thread Entered:%d\n",self);
lock(self);
for(i=0;i<MAX;i++)
{
ans++;
unlock(self);
}
}
int main()
{
pthread_t p1,p2;
lock_init();
pthread_create(&p1,NULL,func,(void*)0);
pthread_create(&p2,NULL,func,(void*)1);
pthread_join(p1,NULL);
pthread_join(p2,NULL);
printf("Actual Count: %d | Expected Count: %d\n",
ans, MAX*2);
return 0;
}
launch.json:
{
// 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) petersonAlgorithm ",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/petersonAlgorithm ",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Type: Debugger
Describe the bug
I want to step into the function pthread_create.c of external library pthread.
ERROR:
Unable to open 'pthread_create.c': Unable to read file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c').
To Reproduce
Please include a code sample and
launch.json
configuration.Steps to reproduce the behavior:
2.Build
Unable to open 'pthread_create.c': Unable to read file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu-18.04/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_create.c').
Additional context
test file petersonAlgorithm.c Code:
launch.json:
task.json
console output
The text was updated successfully, but these errors were encountered: