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