]> git.siccegge.de Git - frida/frida.git/blob - src/main.cxx
Install the guile-frida-bindings into system library path
[frida/frida.git] / src / main.cxx
1 #include "disassembler/llvm/include_llvm.hxx"
2
3 #include <climits>
4
5 #include <QApplication>
6 #if QT_VERSION > QT_VERSION_CHECK(5, 2, 0)
7 #define ARGPARSE
8 #endif
9
10 #ifdef ARGPARSE
11 #include <QCommandLineParser>
12 #endif
13 #include <QTextEdit>
14
15 #include "log4cxx/logger.h"
16 #include "log4cxx/basicconfigurator.h"
17
18 #include "gui/Mainwindow.hxx"
19 #include "core/InformationManager.hxx"
20 #include "disassembler/llvm/LLVMDisassembler.hxx"
21 #include "Config.hxx"
22
23 int main(int argc, char** argv)
24 {
25 QApplication app(argc, argv);
26
27 log4cxx::BasicConfigurator::configure();
28 log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main"));
29
30 #ifdef ARGPARSE
31 QCommandLineParser parser;
32 #endif
33
34 QApplication::setApplicationName("frida");
35 QApplication::setApplicationVersion("0.0");
36 QApplication::addLibraryPath(CONFIG_LIBDIR "/frida/plugins/Interpreter");
37 #ifdef ARGPARSE
38 parser.addHelpOption();
39 parser.addVersionOption();
40 parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble."));
41
42 parser.process(app);
43 #endif
44
45 InformationManager iman;
46
47 LOG4CXX_DEBUG(_logger, "Initializing LLVM");
48 llvm::InitializeAllTargetInfos();
49 llvm::InitializeAllTargetMCs();
50 llvm::InitializeAllAsmParsers();
51 llvm::InitializeAllDisassemblers();
52
53 LOG4CXX_DEBUG(_logger, "Initializing Qt");
54
55 std::string filename = "";
56 #ifdef ARGPARSE
57 if (! parser.positionalArguments().isEmpty()) {
58 filename = parser.positionalArguments().at(0).toStdString();
59 }
60 #endif
61
62 Mainwindow m(&iman);
63 m.show();
64 iman.reset(filename);
65 return app.exec();
66 }