]> git.siccegge.de Git - frida/frida.git/blob - src/main.cxx
Properly move Functionality into FunctionWidget
[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 QApplication::setApplicationVersion("0.0");
35 #ifdef ARGPARSE
36 parser.addHelpOption();
37 parser.addVersionOption();
38 parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble."));
39
40 parser.process(app);
41 #endif
42
43 InformationManager iman;
44
45 LOG4CXX_DEBUG(_logger, "Initializing LLVM");
46 llvm::InitializeAllTargetInfos();
47 llvm::InitializeAllTargetMCs();
48 llvm::InitializeAllAsmParsers();
49 llvm::InitializeAllDisassemblers();
50
51 LOG4CXX_DEBUG(_logger, "Initializing Qt");
52
53 std::string filename = "";
54 #ifdef ARGPARSE
55 if (! parser.positionalArguments().isEmpty()) {
56 filename = parser.positionalArguments().at(0).toStdString();
57 }
58 #endif
59
60 Mainwindow m(&iman);
61 m.show();
62 iman.reset(filename);
63 return app.exec();
64 }