diff --git a/docs/source/common-errors.rst b/docs/source/common-errors.rst index fd76e38a..97144e2b 100644 --- a/docs/source/common-errors.rst +++ b/docs/source/common-errors.rst @@ -16,7 +16,7 @@ Compilation error ----------------- r_core development package not found -~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you installed radare2 and still encounter this error, it could be that your ``PATH`` environment variable is set improperly (doesn’t contain diff --git a/docs/source/user-docs.rst b/docs/source/user-docs.rst index d16181f1..e78c484a 100644 --- a/docs/source/user-docs.rst +++ b/docs/source/user-docs.rst @@ -11,5 +11,6 @@ Cutter is an advanced reverse engineering platform that is powered by radare2. T :titlesonly: :glob: + user-docs/command-line user-docs/menus diff --git a/docs/source/user-docs/command-line.rst b/docs/source/user-docs/command-line.rst new file mode 100644 index 00000000..727632c7 --- /dev/null +++ b/docs/source/user-docs/command-line.rst @@ -0,0 +1,63 @@ +Command line options +==================== + +Synopsis +-------- + +**Cutter** [*options*] [<*filename*>] + + +Options +------- + +.. option:: + + Filename to open. If not specified file selection dialog will be shown. + +.. option:: -h, --help + + Displays help on commandline options. + +.. option:: --help-all + + Displays help including Qt specific options. + +.. option:: -v, --version + + Displays version information. + +.. option:: -A, --anal + + When opening a file automatically perform analysis at given level. Requires + :option:`` to be specified. Following levels are available: + + **0** + No analysis. + + **1** + aaa + + **2** + aaaa (experimental) + +.. option:: -F, --format + + Force using a specific file format (bin plugin) + +.. option:: -B, --base + + Load binary at a specific base address + +.. option:: -i + + Run script file + +.. option:: --pythonhome + + PYTHONHOME to use for embedded python interpreter + +.. option:: --no-output-redirect + + Disable output redirection. Some of the output in console widget will not + be visible. Use this option when debuging a crash or freeze and output + redirection is causing some messages to be lost. diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index ac3466b9..0df591c3 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -99,6 +99,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc "PYTHONHOME"); cmd_parser.addOption(pythonHomeOption); + QCommandLineOption disableRedirectOption("no-output-redirect", + QObject::tr("Disable output redirection." + " Some of the output in console widget will not be visible." + " Use this option when debuging a crash or freeze and output " + " redirection is causing some messages to be lost.")); + cmd_parser.addOption(disableRedirectOption); + cmd_parser.process(*this); QStringList args = cmd_parser.positionalArguments(); @@ -137,6 +144,10 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc Config()->loadInitial(); Core()->loadCutterRC(); + if (cmd_parser.isSet(disableRedirectOption)) { + Config()->setOutputRedirectionEnabled(false); + } + if (R2DecDecompiler::isAvailable()) { Core()->registerDecompiler(new R2DecDecompiler(Core())); } @@ -367,4 +378,3 @@ void CutterProxyStyle::polish(QWidget *widget) } #endif // QT_VERSION_CHECK(5, 10, 0) < QT_VERSION } - diff --git a/src/common/Configuration.cpp b/src/common/Configuration.cpp index 09b02d65..66138903 100644 --- a/src/common/Configuration.cpp +++ b/src/common/Configuration.cpp @@ -728,3 +728,13 @@ void Configuration::setBitmapExportScaleFactor(double inputValueGraph) s.setValue("bitmapGraphExportScale", inputValueGraph); } +void Configuration::setOutputRedirectionEnabled(bool enabled) +{ + this->outputRedirectEnabled = enabled; +} + +bool Configuration::getOutputRedirectionEnabled() const +{ + return outputRedirectEnabled; +} + diff --git a/src/common/Configuration.h b/src/common/Configuration.h index f77129ae..1bfae6c5 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h @@ -41,6 +41,7 @@ private: #ifdef CUTTER_ENABLE_KSYNTAXHIGHLIGHTING KSyntaxHighlighting::Repository *kSyntaxHighlightingRepository; #endif + bool outputRedirectEnabled = true; // Colors void loadBaseThemeNative(); @@ -181,6 +182,15 @@ public: void setBitmapTransparentState(bool inputValueGraph); void setBitmapExportScaleFactor(double inputValueGraph); + /** + * @brief Enable or disable Cutter output redirection. + * Output redirection state can only be changed early during Cutter initalization. + * Changing it later will have no effect + * @param enabled set this to false for disabling output redirection + */ + void setOutputRedirectionEnabled(bool enabled); + bool getOutputRedirectionEnabled() const; + public slots: void refreshFont(); signals: diff --git a/src/widgets/ConsoleWidget.cpp b/src/widgets/ConsoleWidget.cpp index 9999950a..94f0ddcc 100644 --- a/src/widgets/ConsoleWidget.cpp +++ b/src/widgets/ConsoleWidget.cpp @@ -128,7 +128,9 @@ ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) : completer->popup()->installEventFilter(this); - redirectOutput(); + if (Config()->getOutputRedirectionEnabled()) { + redirectOutput(); + } } ConsoleWidget::~ConsoleWidget()