Domain Specific Debugging Tools Volker Krause vkrause@kde.org - - PowerPoint PPT Presentation

domain specific debugging tools
SMART_READER_LITE
LIVE PREVIEW

Domain Specific Debugging Tools Volker Krause vkrause@kde.org - - PowerPoint PPT Presentation

Domain Specific Debugging Tools Volker Krause vkrause@kde.org General Purpose Tools Generic debuggers Instruction-level debuggers (gdb) printf Similar for profilers No understanding of your frameworks Framework Complexity


slide-1
SLIDE 1

Domain Specific Debugging Tools

Volker Krause vkrause@kde.org

slide-2
SLIDE 2

General Purpose Tools

  • Generic debuggers
  • Instruction-level debuggers (gdb)
  • printf
  • Similar for profilers
  • No understanding of your frameworks
slide-3
SLIDE 3

Framework Complexity

  • Increasing abstraction
  • Qt model/view
  • Asynchronous API
  • KJob
  • Distributed architecture
  • Akonadi/Nepomuk
  • Runtime interpreted code / JIT compiler
  • QML/JavaScript
slide-4
SLIDE 4

Debugging JIT'ed QML in GDB?

  • Requires understanding of framework internals
  • Inefficient
  • In some cases even impossible for mere mortals
  • In no way specific to Qt/KDE, but we tend to build

nice frameworks :)

slide-5
SLIDE 5

Adapting the Tools

  • Make tools understand the frameworks
  • No longer general purpose
  • Requires specialized tools for each framework
  • Removes the need of knowing internals
  • Makes usage of a framework much more efficient
  • Increasingly important feature for your framework
slide-6
SLIDE 6

What do we have already?

  • Developer API
  • q/kDebug operator<< overloads
  • ModelTest
  • Introspection Tools
  • QDBusViewer
  • Akonadi Console, Plasma Engine Explorer, NepSak
  • GammaRay
slide-7
SLIDE 7

Do we have more?

  • Built-in debugging features
  • QT_FLUSH_PAINT, QDBUS_DEBUG, ...
  • D-Bus interfaces to dump internal state (eg.
  • rg.kde.dfaure.dump)
  • Full-blown development environments
  • QML tooling in QtCreator
slide-8
SLIDE 8

Should I build my own?

  • Struggling with complex control flow
  • Repeatedly adding the same non-trivial debug
  • utput
  • Complex internal structures that benefit from a

specialized visualization

  • Performance metrics lacking correlation to the

actual cost cause

slide-9
SLIDE 9

But it pollutes my code!

  • Having development code built in is perfectly fine!
  • Disable by default
  • compile time switches
  • runtime switches
  • Called on-demand
  • e.g. using D-Bus to trigger additional diagnostics
  • Introspection hooks/callbacks
  • overwriting with library preloading
  • registration of callbacks for interesting events
slide-10
SLIDE 10

Building Stand-Alone Tools

  • Using your framework's public API
  • Using introspection hooks
  • GammaRay provides you easy access to those of Qt
  • Binary instrumentation
  • Pin, Valgrind
  • OS-level tracing tools
  • DTrace, SystemTap
slide-11
SLIDE 11

Qt Introspection Hooks

  • Load additional code into any Qt application
  • Watch interesting events such as QObject

creation/destruction

  • Runtime information using QMetaObject et al.
  • Powerful, but:
  • platform specific
  • hooks triggered before virtual tables exist
  • multi-threading
slide-12
SLIDE 12

GammaRay

  • Framework for building Qt introspection tools
  • Hides the nasty details
  • Startup or runtime injection on Linux/Mac/Win
  • Plug-in based with very simple API
  • object creation/destruction notification
  • flat object model
  • hierarchical object model
slide-13
SLIDE 13

Let's try!

slide-14
SLIDE 14

Where do I get it?

  • http://github.com/KDAB/GammaRay
  • Free Software (GPL)
  • Mailing-list: gammaray-interest@kdab.com
slide-15
SLIDE 15

Conclusion

  • Efficiency of using a framework is important
  • Increased complexity requires better tooling
  • Tools will help both framework authors and users
  • Makes your framework more efficient to use
  • Time invested in tooling easily pays off
  • Consider turning your repeatedly added debug
  • utput into something more reusable :-)
slide-16
SLIDE 16

Questions?