microsoft / microsoft/vscode-cpptools

IntelliSense errors with chromium codebase

Open
#11,736 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug investigate: repro Language Service reliability
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Linux PC 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • VS Code Version: 1.83.1
  • C/C++ Extension Version: 1.18.5
  • If using SSH remote, specify OS of remote machine:
    my docker which is ubuntu 20.04
Bug Summary and Steps to Reproduce

Bug Summary:
while parsing some simple projects, c_cpp works well
while parsing chromium, the language server always crash

Steps to reproduce:

  1. download chromium and compile chromium
  2. run "./tools/clang/scripts/generate_compdb.py -p out_x86/default > out_x86/default/compile_commands.json" to generate compile_commands.json
  3. configure the project and start code analysis
  4. See error

Expected behavior:

Configuration and Logs
here is my configuration:

    "C_Cpp.autoAddFileAssociations": false,
    "C_Cpp.default.compileCommands": "${workspaceFolder:src}/out_x86/default/compile_commands.json",
    "C_Cpp.intelliSenseEngine": "default",
    "C_Cpp.intelliSenseCachePath": "${workspaceFolder:src}",
    "C_Cpp.formatting": "disabled",
    "C_Cpp.loggingLevel": "Debug",
    // "C_Cpp.errorSquiggles": "disabled",
    //"C_Cpp.workspaceParsingPriority": "low",

here are some logs while crash happens:

Attempting to get defaults from C++ compiler in compile_commands.json file: '/home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++'
Compiler query command line: /home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++ -Wall -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Wno-deprecated-non-prototype -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -flto=thin -fsplit-lto-unit -fwhole-program-vtables -fcomplete-member-pointers -m64 -msse3 -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fdata-sections -ffunction-sections -fno-unique-section-names -fno-omit-frame-pointer -g0 -fprofile-use=../../chrome/build/pgo_profiles/chrome-linux-5005-1653490340-736db1732ea5f3959ee14f875a1211fdb84a54af.profdata -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date -Wno-backend-plugin -fsanitize=cfi-vcall -fsanitize=cfi-icall -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wconversion -Wno-float-conversion -Wno-sign-conversion -Wno-implicit-float-conversion -Wno-implicit-int-conversion -Wno-shadow -std=c++17 -Wno-trigraphs -fno-aligned-new -fno-exceptions -fno-rtti -nostdinc++ --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -Wno-deprecated-declarations -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in compile_commands.json file: '/home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.18.5
cpptools version (native): 1.18.3.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
Querying compiler for default C++ language standard using command line: /usr/bin/clang -x c++ -E -dM /dev/null
Detected language standard version: c++14
Querying compiler's default target using command line: "/usr/bin/clang" -dumpmachine
Compiler returned default target value: x86_64-pc-linux-gnu
Compiler query command line: /usr/bin/clang -std=c17 -m64 -Wp,-v -fno-blocks -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
Compiler query command line: /usr/bin/clang -std=c++14 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
LSP: (received) cpptools/didChangeCppProperties (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 3)
LSP: (received - deferred) textDocument/didOpen: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc
LSP: (received - deferred) cpptools/activeDocumentChange: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc
LSP: (received - deferred) cpptools/getDocumentSymbols: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc (id: 4)
LSP: (received - deferred) cpptools/getInlayHints: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc (id: 5)
LSP: (received - deferred) cpptools/activeDocumentChange: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc
LSP: (received - deferred) cpptools/textEditorSelectionChange
LSP: (received - deferred) cpptools/resumeParsing
LSP: (received - deferred) cpptools/getFoldingRanges: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc (id: 6)
LSP: (received - deferred) cpptools/getSemanticTokens: file:///home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/ui/gl/gl_context_egl.cc (id: 7)
Code browsing service initialized
Attempting to get defaults from compiler found on the machine: '/usr/bin/clang'
Attempting to get defaults from compiler found on the machine: '/usr/bin/clang'
Querying compiler for default C++ language standard using command line: /home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++ -x c++ -E -dM /dev/null
Detected language standard version: c++14
Querying compiler's default target using command line: "/home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++" -dumpmachine
Compiler returned default target value: x86_64-unknown-linux-gnu


by the way,i modify the compile_commands.json because the following errors will occur with the default compile_commands.json generate by chromium

Attempting to get defaults from C++ compiler in compile_commands.json file: '/home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++'
Compiler query command line: /home/jinbiao/work/google_chromium-102.0.5005.200/chromium/src/out_x86/default/../../third_party/llvm-build/Release+Asserts/bin/clang++ -Wall -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Wno-deprecated-non-prototype -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -flto=thin -fsplit-lto-unit -fwhole-program-vtables -fcomplete-member-pointers -m64 -msse3 -ffile-compilation-dir=. -no-canonical-prefixes -fno-omit-frame-pointer -g0 -fprofile-use=../../chrome/build/pgo_profiles/chrome-linux-5005-1653490340-736db1732ea5f3959ee14f875a1211fdb84a54af.profdata -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date -Wno-backend-plugin -fsanitize=cfi-vcall -fsanitize-ignorelist=../../tools/cfi/ignores.txt -fsanitize=cfi-icall -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wmissing-field-initializers -Wno-shadow -Wunreachable-code -Wshorten-64-to-32 -O3 -fdata-sections -ffunction-sections -fno-unique-section-names -Wno-string-concatenation -std=c++17 -Wno-trigraphs -fno-aligned-new -fno-exceptions -fno-rtti -nostdinc++ --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
clang++: error: no such file or directory: '../../tools/cfi/ignores.txt'

i remove all the compile flags with '../../tools/cfi/ignores.txt'
Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with Chromium's generated out_x86/default/compile_commands.json and inspect the compiler-query logs, especially the missing ../../tools/cfi/ignores.txt path. Compare the modified and generated compile commands while parsing ui/gl/gl_context_egl.cc; done means IntelliSense remains running and can analyze the Chromium project without the reported crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.