X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fmain.cxx;h=d284d4fcb0a3e685d797877182465505f9bb25a7;hp=afcf93007b3e564d5bbfd74ccbdadfcee5f3a08b;hb=ebe7b20f8756f239fb61b5a3e3faabeebe708ad1;hpb=2a014774e29e324bc5b5f26143d0384351738ca1 diff --git a/src/main.cxx b/src/main.cxx index afcf930..d284d4f 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -1,35 +1,66 @@ -#include "include.hxx" +#include "disassembler/llvm/include_llvm.hxx" -#include #include #include +#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0) +#define ARGPARSE +#endif + +#ifdef ARGPARSE +#include +#endif #include #include "log4cxx/logger.h" #include "log4cxx/basicconfigurator.h" -#include "Binary.hxx" #include "gui/Mainwindow.hxx" - -using std::cout; -using std::cin; -using std::cerr; +#include "core/InformationManager.hxx" +#include "disassembler/llvm/LLVMDisassembler.hxx" +#include "Config.hxx" int main(int argc, char** argv) { - log4cxx::BasicConfigurator::configure(); - log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main")); - LOG4CXX_DEBUG(_logger, "Initializing LLVM"); - llvm::InitializeAllTargetInfos(); - llvm::InitializeAllTargetMCs(); - llvm::InitializeAllAsmParsers(); - llvm::InitializeAllDisassemblers(); + QApplication app(argc, argv); + + log4cxx::BasicConfigurator::configure(); + log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main")); + +#ifdef ARGPARSE + QCommandLineParser parser; +#endif + + QApplication::setApplicationName("frida"); + QApplication::setApplicationVersion("0.0"); + QApplication::addLibraryPath(CONFIG_LIBDIR "/frida/plugins/Interpreter"); +#ifdef ARGPARSE + parser.addHelpOption(); + parser.addVersionOption(); + parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble.")); + + parser.process(app); +#endif + + InformationManager iman; + + LOG4CXX_DEBUG(_logger, "Initializing LLVM"); + llvm::InitializeAllTargetInfos(); + llvm::InitializeAllTargetMCs(); + llvm::InitializeAllAsmParsers(); + llvm::InitializeAllDisassemblers(); - QApplication app(argc, argv); + LOG4CXX_DEBUG(_logger, "Initializing Qt"); - Mainwindow m; - m.show(); + std::string filename = ""; +#ifdef ARGPARSE + if (! parser.positionalArguments().isEmpty()) { + filename = parser.positionalArguments().at(0).toStdString(); + } +#endif - return app.exec(); + Mainwindow m(&iman); + m.show(); + iman.reset(filename); + return app.exec(); }