]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/Mainwindow.cxx
Allow opening of binary via comman argument
[frida/frida.git] / src / gui / Mainwindow.cxx
index 061734a5bc946dde58082641543aed5ec24d6c0c..fd0c24595da1bfe0efc675ac395970ccce764ece 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <QtGui>
 
 
 #include <QtGui>
 
-Mainwindow::Mainwindow()
+Mainwindow::Mainwindow(const std::string& filename)
 {
     openAction = new QAction(tr("&Open"), this);
     // saveAction = new QAction(tr("&Save"), this);
 {
     openAction = new QAction(tr("&Open"), this);
     // saveAction = new QAction(tr("&Save"), this);
@@ -37,6 +37,8 @@ Mainwindow::Mainwindow()
             stackedWidget, SLOT(setCurrentIndex(int)));
 
     setWindowTitle(tr("Notepad"));
             stackedWidget, SLOT(setCurrentIndex(int)));
 
     setWindowTitle(tr("Notepad"));
+
+       openBinary(filename);
 }
 
 void Mainwindow::quit()
 }
 
 void Mainwindow::quit()
@@ -54,8 +56,12 @@ void Mainwindow::open() {
     QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
                                                     tr("Binaries (*)"));
 
     QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
                                                     tr("Binaries (*)"));
 
-    if (fileName != "") {
-        disassembler.reset(new LLVMDisassembler(fileName.toStdString()));
+       openBinary(fileName.toStdString());
+}
+
+void Mainwindow::openBinary(const std::string& filename) {
+    if (filename != "") {
+        disassembler.reset(new LLVMDisassembler(filename));
         // curBin = new Binary(fileName.toStdString());
 
         // std::vector<std::string> symbols = curBin->getSymbols();
         // curBin = new Binary(fileName.toStdString());
 
         // std::vector<std::string> symbols = curBin->getSymbols();