Extension hangs if a child process causes "cannot execute binary file: Exec format error"
VSCode Version: 1.40.1 OS Version: WIN10 10.0.18363.476 Extensions:
- Remote-WSL 0.40.3
- C/C++ 0.26.1
- C++ Intellisense 0.2.2
- Include Autocomplete 0.0.4
Steps to Reproduce: open folder in Remote WSL (ubuntu 18.04) open main.cc and it always shows that "Loading document symbols for main.cc ..."
Does this issue occur when all extensions are disabled?: Yes/No when all extensions are disabled, OUTLINE shows that "The active editor cannot provide outline information"
furthermore, when the cursor stays at number 0, it shows "loading...", Find All References for functions gives nothing,

You might be hitting bug https://github.com/microsoft/vscode-cpptools/issues/4470 .
You could try downloading and installing the vsix at https://github.com/microsoft/vscode-cpptools/releases/download/0.26.2-insiders/cpptools-linux.vsix on the remote WSL instance to see if that fixes it.
You may also want to try disabling the C/C+ IntelliSense extension, which conflict with functionality provided by our C/C++ extension.
I uninstalled the C++ Intellisense 0.2.2 and installed C/C++ 0.26.2-Insiders, and problems remain the same as before. What else should I provide to find where the bug is?
There is either some problem creating the database or some problem parsing the files. Are you able to get a simple file with "int test;" to show symbols? If you change the C_Cpp.default.browse.databaseFilename setting to "${workspaceFolder}/.vscode/vc.db" do you see the file get created? It's possible the default location we choose might not have appropriate write permissions. If you enable debug logging (https://code.visualstudio.com/docs/cpp/enable-logging-cpp) do you see any error messages relating to the database? There's a C/C++: Reset IntelliSense Database command that will rebuild the database (if you do that, do you see "tag parsing" messages?). Also, make sure your files.exclude setting doesn't use something like "**/.*" which could cause all files to be excluded from parsing.
There is either some problem creating the database or some problem parsing the files. Are you able to get a simple file with "int test;" to show symbols? Reply: No, it is not able to show the only symbol.
If you change the C_Cpp.default.browse.databaseFilename setting to "${workspaceFolder}/.vscode/vc.db" do you see the file get created? It's possible the default location we choose might not have appropriate write permissions. Reply: Yes, it is created.
If you enable debug logging (https://code.visualstudio.com/docs/cpp/enable-logging-cpp) do you see any error messages relating to the database? Reply: It does not show any error messages. I posted the log file here
There's a C/C++: Reset IntelliSense Database command that will rebuild the database (if you do that, do you see "tag parsing" messages?). Reply: Can you tell me how to run this command exactly?
Also, make sure your files.exclude setting doesn't use something like "**/.*" which could cause all files to be excluded from parsing. Reply: It seems to me that I have not set anything to files.exclude. Can you tell me how to confirm it? c++ logs.txt
I installed C/C++ 0.26.1 back in WSL and now it works. So the two measurements might fix this issue, one it that I uninstalled C/C++ Intellsense, and two is that I reopened visual studio code for several times.
but the C/C++ 0.26.2 Insiders does not work, strange. would you like me to help to dig deeper to find out the rootcause for this issue?
The "C/C++: Reset IntelliSense Database" command is accessible via View->Command Palette (if you're using another display language it might be translated).
Your files.exclude look good.
We have a known bug with 0.26.2-insiders that will cause the Outline view to be blank for the first opened file -- closing and reopening the file should fix it (https://github.com/microsoft/vscode-cpptools/pull/4621). Is that what you're hitting? If not, if you could find out more info on why 0.26.2-insiders isn't working for you that would help us fix the issue before we publish 0.26.2. It's working for me when I install the cpptools-linux.vsix on the WSL Ubuntu 18 remote instance. I didn't see any log files.
Actually, I was mistaken -- looks like https://github.com/microsoft/vscode-cpptools/pull/4621 fixed an issue that didn't ship with insiders. I'll look into what bug I was seeing...
unfortunately this issue came back again today! I tried the following:
- Reopen folder in Windows and then Reopen in WSL
- close folder and open it again in WSL
- close main.cc and double click to open again in the editor
- close VS code and restart it again
- set C_Cpp.default.browse.databaseFilename setting to "${workspaceFolder}/.vscode/vc.db" But the issue remains, outline displaying "loading document symbols for main.cc..."
I tried the Reset IntelliSense Database command and I didn't see any logs printed out
C/C++ and other logs: cpp.log ext_host.log ext_server.log main.log shared.log remote_ext.log
Your log shows it getting stuck at Attempting to get defaults from compiler in "compilerPath" property: '/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++'
We don't currently support targeting arm architectures so that might cause some IntelliSense problems, but ideally it would not cause the extension to get stuck indefinitely.
Can you confirm that all the C/C++ extensions features are unavailable at this point, not just the Outline view, right?
Can you try changing your compilerPath to a different compiler?
I tried several times by closing and reopening vs code, or reopen folder in Windows and WSL back and forth, and it worked for once. This is the C/C++ log: cpp_success.log
I recently work on an embedded project and it cannot be changed to other compilers as it is for a specified embedded processer.
when the outline goes empty, Find All Reference does not work also, it might be that all the C/C++ extensions are effected. You can give me a checklist and I go over it to check them out
Yeah, that log looks good, although you may want to use gcc-x86 intelliSenseMode instead of gcc-x64.
Find All References and the outline view both share the database, so if there's some bug that makes the database unusable then it would affect both features.
I was able to repro a similar bug via opening the same folder with 2 instances of VS code in WSL and I get a "Time out waiting for tag parser initialization" error and hovering over the database icon shows "Tag parser initializing..." -- is that what you're hitting or is it something different? It's possible a dangling process might be locking the database which could cause a similar issue.
I'm going to be OOF till Friday. @Colengms might be able to follow up.
Thanks for your advise, I switched to gcc-x86 now. strangely enough, once it worked, it seems it keeps working fine... I am going to restart Windows to check it will come back, and post it here if I find something and confirm Have a good time
I restarted my desktop and the issue did come back, last message for C/C++ is Attempting to get defaults from compiler in "compilerPath" property: '/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++'
but I cannot find where the database icon is, can you tell me?
I don't see the database icon in your screenshots. It would appear in the bottom status bar on the left of the icons on the right side (same area the flame would appear) and it looks like a cylinder, but if you don't see it, then the database initialization might not be stuck.
then we may encounter different issues
I think the issue is narrowed down to this: on windows start, or on restart, the C/C++ extension get stuck at Attempting to get defaults from compiler in "compilerPath" property: '/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++', which cause the outline not showing the right symbols, sometimes it pass this stage and everything then works fine. what information do you need to find out why it get stuck at that stage?
good news! I have tried this out, the extension gets stuck because the compiler /opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ is not runnable. This cross compiler can only run on 32bit environment, but ubuntu18.04 is 64bit. so it is not runnable until service of binfmt-support is started, which provide a simulated 32bit environment for this compiler. After sudo service binfmt-support start is executed in ubuntu terminal, the outline in vs code is able to show the right symbols. The only thing that should be improved is not to go into a dead loop. You can show an error message like "the compiler is not runnable, please check and try again".
This issue can be reproduced by setting the compiler to an invalid one, so others could encounter this issue as well.
@zhangguofu Thanks for providing the repro info. Do you know how we can obtain a compiler like that which is able to repro the bug? Normally a process that is unsupported for querying will fail out instead of getting stuck (i.e. for invalid compilers we've tested on so far it doesn't get stuck). On Windows, we have a timeout, so maybe we could add a timeout for Linux, but it would help if we had a way to test this case (because I'm not sure exactly which system call is getting stuck).