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