| Summary: | KDevelop crashes on startup | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | nbgyan <nanabaahgyan> |
| Component: | general | Assignee: | kdevelop-bugs-null |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | gjditchfield, kde, mail, sknauss |
| Priority: | NOR | Keywords: | drkonqi |
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Neon | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/kdevelop/kdevelop/commit/03a16bf1f5d99380dfa927ba4660935d43fae483 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
nbgyan
2021-01-10 14:06:02 UTC
Hitting that too when you run into this, could you please do me a favor and attach GDB and then go to frame #8 0x00007f76e5df973a in (anonymous namespace)::Visitor::setTypeSize(CXType, KDevelop::AbstractType*) (type=..., kdevType=0x7f76cc7b5190, this=<optimized out>) at ./plugins/clang/duchain/builder.cpp:934 and then do (gdb) print type that may give us a way to skip this type when it's known-to-crash. (In reply to Milian Wolff from comment #2) > when you run into this, could you please do me a favor and attach GDB and > then go to frame > > #8 0x00007f76e5df973a in (anonymous > namespace)::Visitor::setTypeSize(CXType, KDevelop::AbstractType*) (type=..., > kdevType=0x7f76cc7b5190, this=<optimized out>) at > ./plugins/clang/duchain/builder.cpp:934 > > and then do > > (gdb) print type > > that may give us a way to skip this type when it's known-to-crash. Tried in vain to do this with gdb but I realised that the issue is with the background parser only when I tried setting up an imported project like plasma-discover for development on my workstation. After using kdesrc-build to fetch discover and trying to import the project into kdevelop from CMakelist.txt it works fine. And then it crashes because the background parser stalls at some point. This does not happen if, say, I start a new project from scratch. I hope this helps. no it doesn't help I'm afraid :) I need either a simple way to reproduce or the info I requested - otherwise I don't really know what to do I have it in gdb
(gdb) p type
$1 = {kind = CXType_Auto, data = {0x7fff6c9d34a0, 0x7fff6cbe4790}}
I am also available on irc if you need more infos
can you try to call clang_getCanonicalType beforehand, and see if the issue persists? something like the following:
```
diff --git a/plugins/clang/duchain/builder.cpp b/plugins/clang/duchain/builder.cpp
index 1024ca3100..796c7ce2dc 100644
--- a/plugins/clang/duchain/builder.cpp
+++ b/plugins/clang/duchain/builder.cpp
@@ -928,6 +928,8 @@ void Visitor::setTypeSize(CXType type, AbstractType* kdevType) const
{
if (kdevType->whichType() == AbstractType::TypeFunction)
return;
+
+ type = clang_getCanonicalType(type);
if (type.kind == CXType_Elaborated)
return;
```
If it persists, can you try to add CXType_Auto to the early return check and re-run the clang unit tests and see if it affects size information on lines like
```
auto foo = 4;
```
(In reply to Milian Wolff from comment #6) > can you try to call clang_getCanonicalType beforehand, and see if the issue > persists? something like the following: > > ``` > diff --git a/plugins/clang/duchain/builder.cpp > b/plugins/clang/duchain/builder.cpp > index 1024ca3100..796c7ce2dc 100644 > --- a/plugins/clang/duchain/builder.cpp > +++ b/plugins/clang/duchain/builder.cpp > @@ -928,6 +928,8 @@ void Visitor::setTypeSize(CXType type, AbstractType* > kdevType) const > { > if (kdevType->whichType() == AbstractType::TypeFunction) > return; > + > + type = clang_getCanonicalType(type); > if (type.kind == CXType_Elaborated) > return; > > ``` > > If it persists, can you try to add CXType_Auto to the early return check and > re-run the clang unit tests and see if it affects size information on lines > like > > ``` > auto foo = 4; > ``` I could do that but sadly not judge the impact because with my self compiled KDevelop I cannot reproduce this crash that happens with the system package. Maybe the clang version makes a difference here as I build against clang 10? I will try to rebuild against 8 to see if I can reproduce the crash this way. Update: after disabling Background Parser in Settings->Configure KDevelop, crashes have stopped. you could build against clang-8 by setting up the cmake env properly anyhow, I guess I should just blindly push this change and then let neon update their packages, maybe it helps - it certainly sounds like the correct thing to do (In reply to Milian Wolff from comment #9) > you could build against clang-8 by setting up the cmake env properly > > anyhow, I guess I should just blindly push this change and then let neon > update their packages, maybe it helps - it certainly sounds like the correct > thing to do I build against clang-8 but got no crash so far, also sadly I cannot provoke the systems packages to crash anymore, sorry :/ *** Bug 431796 has been marked as a duplicate of this bug. *** *** Bug 431887 has been marked as a duplicate of this bug. *** Note that the latter bug reporter (hefee on IRC) was using a version with the `type = clang_getCanonicalType(type);` commit, so it appears not to be a complete fix. it seems like it only affects older llvm versions, so I'll disable these features with anything older than llvm 10 - let's see if that covers it otherwise I'll need a way to reproduce this Git commit 03a16bf1f5d99380dfa927ba4660935d43fae483 by Milian Wolff. Committed on 22/01/2021 at 09:32. Pushed by mwolff into branch 'master'. Disable calls to clang_Type_getSizeOf for llvm-9 and below Apparently that is unstable upstream. It works fine with llvm-10 and upwards I believe, so let's only keep this functionality for these versions. M +6 -0 plugins/clang/duchain/builder.cpp https://invent.kde.org/kdevelop/kdevelop/commit/03a16bf1f5d99380dfa927ba4660935d43fae483 Thanks a lot: This patch fixed the issue for me. kdevelop is compiled against clang-8. kdevelop 4:5.6.1+p20.04+git20210122.1015-0 works for me. |