[Development] qt_add/removeObject hooks
Volker Krause
volker.krause at kdab.com
Mon Apr 7 17:48:46 CEST 2014
Hi,
I'm looking into making the qt_add/removeObject(QObject*) hooks useful on
more platforms. Having those available considerably improves the results you
get in GammaRay, compared to the fallback mode that tries to find objects via
global event filters and hierarchies.
The current situation is that the hooks work fine on Linux/QNX in combination
with LD_PRELOAD (unless you have a non-recent gold that ignores
QtCore.dynlist). They also work on Mac/Windows, with the nasty function re-
writing code we have in GammaRay, but only if the compiler optimizer isn't
interfering (ie. actually emits those functions, and calls them, preferably
with arguments). My attempts to keep the optimizer far enough away (MSVC:
__declspec(noinline), #pragma optimize("g", off), Clang:
__attribute__(noinline), 'asm("")' in the body) improved things but not to the
point to being usable in release builds (MSVC merges both functions with
qt_startup_hook, and neither MSVC nor Clang provide the QObject* argument).
So unless there's some compiler magic I missed I think this needs a different
approach to be reliable and cross-platform, such as callbacks. Would this be
acceptable? If so, would a minimal approach similar to
qt_register_signal_spy_callbacks() or rather something using
QInternal::registerCallback() be preferred?
qt_startup_hook() is suffering from the same problem, but that's easier to
work around by other means, and it doesn't receive arguments, so both
approaches listed above would work. Any preferences on how to handle this one
while we are at it?
Also, for anyone from Froglogic: Would any of this be causing problems for you
guys?
regards,
Volker
--
Volker Krause | volker.krause at kdab.com | Senior Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4840 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140407/63ca3121/attachment.bin>
More information about the Development
mailing list