forked from qt-creator/qt-creator
Debugger: Provide way to process debuggee output further
Output coming from the debuggee was limited to be printed inside the DebuggerLog and the Application Output pane, but the output might be useful to process differently or even additionally to the default logging. Provide functionality to be able to add an output processor. Change-Id: I715b90b28c64d3cf95bcc2a047a5aba1a56d1058 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class RemoteSetupResult;
|
||||
@@ -43,6 +45,19 @@ DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStart
|
||||
QString *errorMessage,
|
||||
Core::Id runMode = ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
|
||||
|
||||
struct OutputProcessor
|
||||
{
|
||||
enum OutputChannel
|
||||
{
|
||||
StandardOut,
|
||||
StandardError
|
||||
};
|
||||
|
||||
std::function<void(const QString &msg, OutputChannel channel)> process;
|
||||
bool logToAppOutputPane = true;
|
||||
};
|
||||
|
||||
class DEBUGGER_EXPORT DebuggerRunControl : public ProjectExplorer::RunControl
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -57,6 +72,7 @@ public:
|
||||
bool isRunning() const override;
|
||||
QString displayName() const override;
|
||||
bool supportsReRunning() const override;
|
||||
void handleApplicationOutput(const QString &msg, int channel);
|
||||
|
||||
void startFailed();
|
||||
void notifyEngineRemoteServerRunning(const QByteArray &msg, int pid);
|
||||
@@ -71,6 +87,8 @@ public:
|
||||
|
||||
DebuggerStartParameters &startParameters();
|
||||
|
||||
void setOutputProcessor(OutputProcessor *processor);
|
||||
|
||||
signals:
|
||||
void requestRemoteSetup();
|
||||
void aboutToNotifyInferiorSetupOk();
|
||||
@@ -87,6 +105,7 @@ private:
|
||||
|
||||
Internal::DebuggerEngine *m_engine;
|
||||
bool m_running;
|
||||
OutputProcessor *m_outputProcessor = 0;
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
|
||||
Reference in New Issue
Block a user