https://bugs.kde.org/show_bug.cgi?id=434031

            Bug ID: 434031
           Summary: Code parsing stalls (and hogs cpu) on
                    clang_parseTranslationUnit2 error
           Product: kdevelop
           Version: 5.6.2
          Platform: Debian testing
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Language Support: CPP (Clang-based)
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: rasas...@gmail.com
  Target Milestone: ---

Created attachment 136415
  --> https://bugs.kde.org/attachment.cgi?id=136415&action=edit
all threads backtrace after 99% parsing and ctrl-Q kdevelop

When kdevelope is parsing a somewhat big project, with includes properly
configured so all code dependencies are captured, clang parser shows an error,
the background parser never ends parsing (stalled at 99%). Moreover on kdevelop
quit (ctrl-Q) the background parser keeps on running hogging the CPU


STEPS TO REPRODUCE
1. Start with a recent zephyr project checkout:
https://docs.zephyrproject.org/latest/getting_started/index.html (up to west
init step)
2. Open zephyr rtos recent version as project (CMake based)
3. Add some important parsing paths in the project language parsing
configuration:
zephyrproject/modules/lib/mcumgr/mgmt/include
zephyrproject/modules/lib/mcumgr/smp/include
zephyrproject/modules/lib/tinycbor/include
zephyrproject/bootloader/mcuboot/boot/bootutil/include
zephyrproject/zephyr/include
zephyrproject/bootloader/mcuboot/boot/zephyr/include
4. Let kdevelop parse the code

OBSERVED RESULT
Background parsing stalls at 99% and exit kdevelop keeps background parser
running, even GUI has been shutdown. You'd need to kill kdevelop (again) for it
to exit.

EXPECTED RESULT
kdevelop properly parses code, tolerates parsing failures or at least stop
background parsing.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Debian testing
kdevelop 5.6.2
KDE Frameworks 5.78.0
Qt 5.15.2

ADDITIONAL INFORMATION
I'm attaching an all threads backtrace. See how there are 2 lengthy stacked
frames threads

console output:

libclang: crash detected during parsing: {
  'source_filename' : 'zephyrproject/zephyr/drivers/dac/dac_dacx0508.c'
  'command_line_args' : ['clang', '-ferror-limit=100', '-fspell-checking', '',
'-Wunused-parameter', '-Wunreachable-code', '-Wall', '-std=c99', '-nostdinc',
'-xc', '-isystemzephyrproject/modules/lib/mcumgr/mgmt/include',
'-isystemzephyrproject/modules/lib/mcumgr/smp/include',
'-isystemzephyrproject/modules/lib/tinycbor/include',
'-isystemzephyrproject/bootloader/mcuboot/boot/bootutil/include',
'-isystem/usr/lib/gcc/arm-none-eabi/8.3.1/include',
'-isystem/usr/lib/gcc/arm-none-eabi/8.3.1/include-fixed',
'-isystem/usr/include/newlib', '-Izephyrproject/zephyr/include',
'-Izephyrproject/bootloader/mcuboot/boot/zephyr/include', '-isystem',
'/usr/lib/llvm-11/lib/clang/11.0.1/include', '-imacros',
'/tmp/kdevelop.uxcuiC'],
  'unsaved_files' : [],
  'options' : 513,
}
kdevelop.plugins.clang: clang_parseTranslationUnit2 return with error code 2
kdevelop.plugins.clang:   (start KDevelop with `KDEV_CLANG_DISPLAY_DIAGS=1
kdevelop` to see more diagnostics)
kdevelop.plugins.clang: Failed to parse translation unit:
"zephyrproject/zephyr/drivers/dac/dac_dacx0508.c"
libclang: crash detected during parsing: {
  'source_filename' : 'zephyrproject/zephyr/subsys/usb/class/audio/audio.c'
  'command_line_args' : ['clang', '-ferror-limit=100', '-fspell-checking', '',
'-Wunused-parameter', '-Wunreachable-code', '-Wall', '-std=c99', '-nostdinc',
'-xc', '-isystemzephyrproject/modules/lib/mcumgr/mgmt/include',
'-isystemzephyrproject/modules/lib/mcumgr/smp/include',
'-isystemzephyrproject/modules/lib/tinycbor/include',
'-isystemzephyrproject/bootloader/mcuboot/boot/bootutil/include',
'-isystem/usr/lib/gcc/arm-none-eabi/8.3.1/include',
'-isystem/usr/lib/gcc/arm-none-eabi/8.3.1/include-fixed',
'-isystem/usr/include/newlib', '-Izephyrproject/zephyr/include',
'-Izephyrproject/bootloader/mcuboot/boot/zephyr/include', '-isystem',
'/usr/lib/llvm-11/lib/clang/11.0.1/include', '-imacros',
'/tmp/kdevelop.hjUibn'],
  'unsaved_files' : [],
  'options' : 513,
}
kdevelop.plugins.clang: clang_parseTranslationUnit2 return with error code 2
kdevelop.plugins.clang:   (start KDevelop with `KDEV_CLANG_DISPLAY_DIAGS=1
kdevelop` to see more diagnostics)
kdevelop.plugins.clang: Failed to parse translation unit:
"zephyrproject/zephyr/subsys/usb/class/audio/audio.c"

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to