[Development] qt_add/removeObject hooks

Thiago Macieira thiago.macieira at intel.com
Mon Apr 7 19:18:40 CEST 2014


Em seg 07 abr 2014, às 17:48:46, Volker Krause escreveu:
> 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?

We should probably move those functions to a separate .cpp, so the optimiser 
doesn't kick in. We don't build with LTCG enabled.

But feel free to make the best API that works for GammaRay and for Squish. 
You're the only users of such an API. We'll abide by the solutions you come up 
with.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list