33 lines
510 B
C++
33 lines
510 B
C++
|
|
// this file injects the debugger into the QApplication
|
|
|
|
#include "qtdebugger.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <QApplication>
|
|
|
|
class QApplication;
|
|
|
|
int QApplication::exec() {
|
|
// init debugger
|
|
QtDebugger debugger;
|
|
|
|
// get real exec call
|
|
static int (*real_exec)() = (int (*)())dlsym(RTLD_NEXT, "_ZN12QApplication4execEv");
|
|
if ( !real_exec ) {
|
|
// failed to init real exec
|
|
return -1;
|
|
}
|
|
|
|
// call real exec call
|
|
int returnVal = real_exec();
|
|
|
|
// end debugger
|
|
|
|
return returnVal;
|
|
}
|
|
|