X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fbindings%2FGuile.cxx;h=aa7ea526118c205f5278e632fef4d554d9e6b887;hb=057e0e59829f19ee4d9a550f2d3dc9fe9df5c92c;hp=863c9ccd23e43ecdbd3716d6b5ef9b9e6af387d7;hpb=38f26697d6998845bacb1d44a92efe8f326a4820;p=frida%2Ffrida.git diff --git a/src/bindings/Guile.cxx b/src/bindings/Guile.cxx index 863c9cc..aa7ea52 100644 --- a/src/bindings/Guile.cxx +++ b/src/bindings/Guile.cxx @@ -12,16 +12,12 @@ namespace { GuileInterpreter::GuileInterpreter() : logger(log4cxx::Logger::getLogger("bindings.Guile")) { - QString socketpath = Settings::get()->getRuntimeDirectory()->canonicalPath() - + "/frida." + QString::number(QCoreApplication::applicationPid(), 16) + ".geiser.sock"; - scm_init_guile(); - - SCM scm_socketpath = scm_from_locale_string(socketpath.toStdString().c_str()); scm_c_use_module("system repl server"); - SCM socket = scm_call_2(scm_c_public_ref("system repl server", "make-unix-domain-server-socket"), - scm_from_locale_keyword("path"), scm_socketpath); - scm_call_1(scm_c_public_ref("system repl server", "spawn-server"), socket); + + geiser = new guile::Geiser(this); + geiser->start(); + scm_c_load_extension("libguile-frida-binding", "scm_init_frida_module"); @@ -32,6 +28,11 @@ GuileInterpreter::GuileInterpreter() LOG4CXX_INFO(logger, "Initializing GUILE finished"); } +GuileInterpreter::~GuileInterpreter() { + geiser->terminate(); + geiser->wait(); +} + int GuileInterpreter::evaluateWithErrorHandling(SCM (*fun)(void *), void* data, std::ostream& stdout, @@ -79,3 +80,17 @@ int GuileInterpreter::loadFile(const std::string& filename, LOG4CXX_DEBUG(logger, "Finished file \"" << filename << "\""); return 0; } + +namespace guile { + void Geiser::run() { + scm_init_guile(); + + QString socketpath = Settings::get()->getRuntimeDirectory()->canonicalPath() + + "/frida." + QString::number(QCoreApplication::applicationPid(), 16) + ".geiser.sock"; + + SCM scm_socketpath = scm_from_locale_string(socketpath.toStdString().c_str()); + SCM socket = scm_call_2(scm_c_public_ref("system repl server", "make-unix-domain-server-socket"), + scm_from_locale_keyword("path"), scm_socketpath); + scm_call_1(scm_c_public_ref("system repl server", "run-server"), socket); + } +}