1

I am trying to develop in C on WSL(2) (using Ubuntu) for a university course but am having trouble using the built in debugger for C/C++ in VSCode (installed via the C/C++ extension. For my testings, I am running this code:

#include <assert.h>
int main() {
    assert(1==0); 
    return 0;
}

When running into the assert, the debugger errors and VSC displays the following message on the bottom right corner:

Unable to open 'raise.c': Unable to read file 'vscode-remote://wsl+ubuntu/build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/raise.c' (Error: Unable to resolve non-existing file 'vscode-remote://wsl+ubuntu/build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/raise.c').

I have tried every single tutorial, github issue and stackoverflow question's answer but nothing has worked.

I have reason to believe that this has to do with VSC not having some kind of permissions to write/create files because if I press on Create File (which is prompted in the message), It says:

Unable to write file 'vscode-remote://wsl+ubuntu/build/glibc-eX1tMB/glibc-2.31/sysdeps/unix/sysv/linux/raise.c' (NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/build')

but, if I create the folder /build and chmod 777 it, it is able to create the file, but not write anything into it.

Does anyone have a method to solve this?

Also, what is raise.c and why do I need it anyways?

N. Rak
  • 132
  • 2
  • 12

2 Answers2

1

According to the GDB skip function:https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html#Skipping-Over-Functions-and-FilesPuede add it to "SetupCommands" under "configurations" in Launch.json:

{
"description": "Skip glibc files",
"text": "-interpreter-exec console \"skip -gfi build/glibc-YYA7BZ/glibc-2.31//**/*\""
}

But no problem, add WSL + Ubuntu / or VSL + ubuntu, it will ignore the path, it does not solve the problem, which may be valid for other environments, but it is not valid if VSCode uses remote connection. According to article number 811:Disable "Unable to open file" during debugThe developers say that the "Skip" command is also looking online, currently (January 27, 2019) I do not know of any other way. But there are other solutions under this issue, no need to compile Glibc library:

Execute this:

$ sudo apt install glibc-source
$ cd /usr/src/glibc
$ sudo tar xvf glibc-2.31.tar.xz

The "2.31" should be changed to the actual version number Source, and can be seen through the "LS" command. Then add that in "settings" in Launch.json

"sourceFileMap": {
    "/build/glibc-YYA7BZ": "/usr/src/glibc"
}

The "YYA7BZ" is changed to the GLIBC suffix appears in the error message. If this method is not valid, you can change the path to: c:/users//AppData/ / / /local packages canonicalGroupLimited.ubuntuonWindows_79RHKP1FNDGSC / /localstate / / rootfs usr/src/glibc, where 79RHKP1FNDGSC should change the folder name on your own system.

Now searching for terminal error information:

Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-p3q623bu.gbr" 1>"/tmp/Microsoft-MIEngine-Out-s4xm3p6g.lqk"

enter image description here

according to the error when executing: ends Call After launching an instance of 'std :: logic_error'This is caused by an empty pointer. One of the possible causes of this problem is that I forgot to add the necessary parameters to add a run program in the "Args" list in "Configurations" in Launch.json.

Source:https://programmerclick.com/article/54012533450/

Claudio
  • 86
  • 6
0

See this procedure, similar error but in different environment. https://stackoverflow.com/a/48287761/16842210

In my case, I used try{}catch{} to print the error and saw what was, had nothing to do with raise.c

Claudio
  • 86
  • 6