From: Christoph Egger Date: Wed, 11 Mar 2015 13:31:26 +0000 (+0100) Subject: Export the Guile interpreter as QtPlugin X-Git-Tag: v0.1~50 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=b99a252c3503b095b6111b59b11a6659e42205c8;p=frida%2Ffrida.git Export the Guile interpreter as QtPlugin The Guile interpreter is now a proper Plugin. Next step is listing + loading scripting plugins properly Closes T10 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4b943..9d27f61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ SET(CMAKE_SWIG_FLAGS -Linkage passive) #INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) SET_SOURCE_FILES_PROPERTIES(src/bindings/guile/frida.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(frida-guile guile src/bindings/guile/frida.i) -SWIG_LINK_LIBRARIES(frida-guile) +SWIG_LINK_LIBRARIES(frida-guile ${GUILE_LDFLAGS}) ################# @@ -47,7 +47,6 @@ SWIG_LINK_LIBRARIES(frida-guile) ################# SET(frida_SOURCES - src/bindings/Guile.cxx src/core/InformationManager.cxx src/core/BasicBlock.cxx src/core/Function.cxx @@ -83,7 +82,32 @@ ADD_DEFINITIONS(${QT_DEFINITIONS}) qt5_use_modules(frida Widgets) -TARGET_LINK_LIBRARIES(frida ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES}) +TARGET_LINK_LIBRARIES(frida + ${QT_LIBRARIES} + ${LLVM_LDFLAGS} + -lLLVM-3.5 + ${LLVM_SYSTEM_LIBS} + ${LOG4CXX_LDFLAGS} + ${QUAZIP_LIBRARIES}) + + +########### +# Plugins # +########### + +# GUILE + +set(plugin_guile_SOURCES + src/bindings/Interpreter.cxx + src/bindings/Guile.cxx) + +set(plugin_guile_HEADERS + src/bindings/Interpreter.hxx + src/bindings/Guile.hxx) + +add_library(guilePlugin MODULE ${plugin_guile_SOURCES} ${plugin_guile_HEADERS_MOC}) +qt5_use_modules(guilePlugin Core) +target_link_libraries(guilePlugin ${QT_LIBRARIES} ${GUILE_LDFLAGS}) ################## # TEST Framework # diff --git a/src/bindings/Guile.hxx b/src/bindings/Guile.hxx index 7c45a95..d67a0dd 100644 --- a/src/bindings/Guile.hxx +++ b/src/bindings/Guile.hxx @@ -5,7 +5,10 @@ #include "Interpreter.hxx" -class GuileInterpreter : public Interpreter { +class GuileInterpreter : public QObject, public Interpreter { + Q_OBJECT + Q_PLUGIN_METADATA(IID "xyz.frida.Interpreter") + Q_INTERFACES(Interpreter) public: GuileInterpreter(); diff --git a/src/bindings/Interpreter.hxx b/src/bindings/Interpreter.hxx index 648301b..898f0e0 100644 --- a/src/bindings/Interpreter.hxx +++ b/src/bindings/Interpreter.hxx @@ -3,6 +3,7 @@ #include #include +#include class Interpreter { public: @@ -20,4 +21,6 @@ public: private: }; +Q_DECLARE_INTERFACE(Interpreter, "xyz.frida.Interpreter") + #endif /* INCLUDE__Interpreter_hxx_ */ diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 47c7885..2036c48 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -40,7 +40,10 @@ Mainwindow::Mainwindow(InformationManager* mgr) QMenu* interpretermenu = menuBar()->addMenu(tr("&Interpreter")); - interpreter["GUILE"] = new GuileInterpreter; + QPluginLoader* loader = new QPluginLoader("libguilePlugin", this); + if (!loader->load()) + LOG4CXX_ERROR(logger, "Loading plugin failed: " << loader->errorString().toStdString()); + interpreter["GUILE"] = qobject_cast(loader->instance()); scripting = new ScriptingDock(interpreter["GUILE"], tr("Scripting"), this); scripting->setAllowedAreas(Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, scripting); diff --git a/src/gui/qt.hxx b/src/gui/qt.hxx index ac08c0b..e0ff092 100644 --- a/src/gui/qt.hxx +++ b/src/gui/qt.hxx @@ -28,5 +28,6 @@ #include #include #include +#include #endif /* INCLUDE__qt_hxx_ */