X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fmain.cxx;h=ebb85e87924d457a80c388a32a62f35a56b26fb6;hp=e5c51287bc605b5d911a81899cf13528a3ad909e;hb=ade1d271328d2153876eb208d10a4525c962951b;hpb=4e665010efc9ff0761d311ddd5f4e704bc93eee8 diff --git a/src/main.cxx b/src/main.cxx index e5c5128..ebb85e8 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -4,12 +4,18 @@ #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; @@ -18,8 +24,25 @@ using std::cerr; int main(int argc, char** argv) { + QApplication app(argc, argv); + log4cxx::BasicConfigurator::configure(); log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main")); + +#ifdef ARGPARSE + QCommandLineParser parser; +#endif + + QApplication::setApplicationName("frida"); +#ifdef ARGPARSE + parser.addHelpOption(); + parser.addVersionOption(); + parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble.")); + + + parser.process(app); +#endif + LOG4CXX_DEBUG(_logger, "Initializing LLVM"); llvm::InitializeAllTargetInfos(); llvm::InitializeAllTargetMCs(); @@ -27,10 +50,15 @@ int main(int argc, char** argv) llvm::InitializeAllDisassemblers(); LOG4CXX_DEBUG(_logger, "Initializing Qt"); - QApplication app(argc, argv); - 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(filename); + m.show(); + return app.exec(); }