Make it possible to lower KCrash to tier 1
AbandonedPublic

Authored by apol on Jan 19 2017, 3:11 PM.

Details

Reviewers
dfaure
Group Reviewers
Frameworks
Summary

Puts in place a plugin system that exposes API to extract information to
send the handler. This allows us to de-couple from different modules that
need to be sequentially instanciated at the moment (and ifdef'd).

An interesting advantage we could get after adopting this is that we could have more framework-specific handlers available.

Test Plan

Crashed kate, still get the right drkonqi.

Diff Detail

Repository
R285 KCrash
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
apol updated this revision to Diff 10353.Jan 19 2017, 3:11 PM
apol retitled this revision from to Make it possible to lower KCrash to tier 1.
apol updated this object.
apol edited the test plan for this revision. (Show Details)
apol added reviewers: Frameworks, dfaure.
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 19 2017, 3:11 PM
apol updated this object.Jan 19 2017, 3:12 PM

I don't understand why a plugin architecture allows to move it to tier1. Is functionality split out? if yes, how does that help?

src/plugins/kstartupinfoplugin.cpp
27

is the \ intended?

apol added a comment.Jan 19 2017, 4:06 PM

I don't understand why a plugin architecture allows to move it to tier1. Is functionality split out? if yes, how does that help?

Ah, you are right, I forgot to mention it. I thought about this process as a 2-step, where the second step would be moving these handlers to frameworksintegration.

anthonyfieroni added inline comments.
src/kcrash.cpp
436–437

You have a comment to follow :)

lcroft edited the test plan for this revision. (Show Details)Jan 19 2017, 5:42 PM
lcroft edited the test plan for this revision. (Show Details)
In D4201#78639, @apol wrote:

I don't understand why a plugin architecture allows to move it to tier1. Is functionality split out? if yes, how does that help?

Ah, you are right, I forgot to mention it. I thought about this process as a 2-step, where the second step would be moving these handlers to frameworksintegration.

Hmm, I don't like that. That turns frameworksintegration into the everything and the kitchen sink. Why should one depend on KIO to get a working KCrash?

In the end that results in worse dependencies than before.

apol updated this revision to Diff 10363.Jan 19 2017, 6:30 PM

Use QVector<const char*> instead of const char*[]

apol marked an inline comment as done.Jan 19 2017, 6:32 PM
dfaure added inline comments.Jan 19 2017, 6:35 PM
src/kcrash.cpp
436–437

You can't use QVector here. We're crashing, likely due to corrupted memory, the whole point of this code is to NOT do any memory allocation. You should revert to const char*[], or use something that always allocates on the stack (e.g. QVarLengthArray, if preallocated to be big enough).

bcooksley edited the test plan for this revision. (Show Details)Jan 19 2017, 7:02 PM
apol updated this revision to Diff 10377.Jan 20 2017, 3:08 AM

Dropped usage of QMap and QVector from the handler

Still using QPluginLoader and QDirIterator which probably are as bad as those.

shumski added inline comments.
src/config-kcrash.h.cmake
7

CMAKE_INSTALL_FULL_PLUGINDIR/kcrashhandlers

dfaure edited edge metadata.Jan 20 2017, 9:29 AM
In D4201#78794, @apol wrote:

Still using QPluginLoader and QDirIterator which probably are as bad as those.

That is a very big problem. QDirIterator could be ported to lower-level APIs, but plugin loading means memory allocations.

You might want to look into starting a helper binary that is part of the kcrash frameworks, rather than loading a plugin directly.

apol added inline comments.Jan 23 2017, 2:37 PM
src/kcrash.cpp
436–437

Yes... that makes sense.

But then possibly worse than that is the use of QMap.

Will rethink the approach.

apol added a comment.Jan 23 2017, 3:12 PM

Please disregard the last message, I didn't mean to send that, I wrote it some days ago.

apol abandoned this revision.Feb 2 2017, 2:20 PM