find_package(PkgConfig)
pkg_check_modules(LOG4CXX REQUIRED liblog4cxx)
pkg_check_modules(GUILE REQUIRED guile-2.0)
+FIND_PACKAGE(SWIG REQUIRED)
+INCLUDE(${SWIG_USE_FILE})
#add_compile_options(${LOG4CXX_CFLAGS})
add_definitions(${LOG4CXX_CFLAGS})
separate_arguments(LLVM_LDFLAGS)
separate_arguments(LLVM_LIBS)
+INCLUDE_DIRECTORIES("src")
+
+#####################
+# Language Bindings #
+#####################
+
+SET(CMAKE_SWIG_FLAGS -Linkage passive)
+#FIND_PACKAGE(PythonLibs)
+#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)
+
+
+#################
+# Main Programm #
+#################
+
SET(frida_SOURCES
src/bindings/Guile.cxx
src/core/InformationManager.cxx
ADD_DEFINITIONS(${QT_DEFINITIONS})
qt5_use_modules(frida Widgets)
-INCLUDE_DIRECTORIES("src")
TARGET_LINK_LIBRARIES(frida ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
(SCM (*)(void *))scm_c_eval_string,
(void*)"(spawn-server)",
handler, NULL);
+ scm_internal_catch(SCM_BOOL_T,
+ (SCM (*)(void *))scm_c_eval_string,
+ (void*)"(load-extension \"libfrida-guile\" \"scm_init_frida_module\")",
+ handler, NULL);
guile_output_port = scm_open_output_string();
guile_error_port = scm_open_output_string();
--- /dev/null
+%module frida
+
+%rename("%(utitle)s") "";
+
+%include <cpointer.i>
+%include <stdint.i>
+%include <std_string.i>
+%include <std_map.i>
+
+%{
+#include "core/Function.hxx"
+#include "core/BasicBlock.hxx"
+#include "core/InformationManager.hxx"
+#include "disassembler/Disassembler.hxx"
+
+ extern InformationManager* current_information_manager;
+%}
+
+namespace std {
+ %template(map_uint64t_BasicBlock) map<unsigned long long, BasicBlock*>;
+}
+
+%inline %{
+ BasicBlock* deref(BasicBlock** x) {
+ return *x;
+ }
+%}
+
+%include "core/Function.hxx"
+%include "core/BasicBlock.hxx"
+%include "core/InformationManager.hxx"
+%include "disassembler/Disassembler.hxx"
+
+extern InformationManager* current_information_manager;
#include <QTemporaryFile>
+InformationManager* current_information_manager;
+
InformationManager::InformationManager()
: logger(log4cxx::Logger::getLogger("InformationManager"))
-{}
+{
+ current_information_manager = this;
+}
InformationManager::~InformationManager() {
for (auto b : blocks)