]> git.siccegge.de Git - frida/frida.git/blob - src/main.cxx
Whitespace cleanup
[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 #include "core/InformationManager.hxx"
21 #include "disassembler/llvm/LLVMDisassembler.hxx"
22
23 using std::cout;
24 using std::cin;
25 using std::cerr;
26
27 int main(int argc, char** argv)
28 {
29 QApplication app(argc, argv);
30
31 log4cxx::BasicConfigurator::configure();
32 log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main"));
33
34 #ifdef ARGPARSE
35 QCommandLineParser parser;
36 #endif
37
38 QApplication::setApplicationName("frida");
39 #ifdef ARGPARSE
40 parser.addHelpOption();
41 parser.addVersionOption();
42 parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble."));
43
44 parser.process(app);
45 #endif
46
47 InformationManager iman;
48
49 LOG4CXX_DEBUG(_logger, "Initializing LLVM");
50 llvm::InitializeAllTargetInfos();
51 llvm::InitializeAllTargetMCs();
52 llvm::InitializeAllAsmParsers();
53 llvm::InitializeAllDisassemblers();
54
55 LOG4CXX_DEBUG(_logger, "Initializing Qt");
56
57 std::string filename = "";
58 #ifdef ARGPARSE
59 if (! parser.positionalArguments().isEmpty()) {
60 filename = parser.positionalArguments().at(0).toStdString();
61 }
62 #endif
63
64 Mainwindow m(&iman);
65 m.show();
66 iman.reset(filename);
67 return app.exec();
68 }