From a3b22a6673664f551179d789790e8209fa320283 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 15 Jan 2025 09:28:34 +0100 Subject: [PATCH] Valgrind: Support CallgrindTool re-running Change-Id: I2a4d6e75afed60e455ec2267f18f381e3b19157f Reviewed-by: hjk --- src/plugins/valgrind/callgrindengine.cpp | 1 - src/plugins/valgrind/callgrindtool.cpp | 37 +++++++++++++----------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index 9eaa4764725..66aeaf07efe 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -30,7 +30,6 @@ CallgrindToolRunner::CallgrindToolRunner(RunControl *runControl) : ValgrindToolRunner(runControl) { setId("CallgrindToolRunner"); - runControl->setSupportsReRunning(false); connect(&m_runner, &ValgrindProcess::valgrindStarted, this, [this](qint64 pid) { m_pid = pid; diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index f865bcdf3da..5d925694e51 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -708,6 +708,26 @@ void CallgrindTool::setupRunner(CallgrindToolRunner *toolRunner) connect(toolRunner, &CallgrindToolRunner::parserDataReady, this, &CallgrindTool::setParserData); connect(runControl, &RunControl::stopped, this, &CallgrindTool::engineFinished); + connect(runControl, &RunControl::aboutToStart, this, [this, toolRunner] { + toolRunner->setPaused(m_pauseAction->isChecked()); + // we may want to toggle collect for one function only in this run + toolRunner->setToggleCollectFunction(m_toggleCollectFunction); + m_toggleCollectFunction.clear(); + + m_toolBusy = true; + updateRunActions(); + + // enable/disable actions + m_resetAction->setEnabled(true); + m_dumpAction->setEnabled(true); + m_loadExternalLogFile->setEnabled(false); + clearTextMarks(); + doClear(); + Debugger::showPermanentStatusMessage(Tr::tr("Starting Function Profiler...")); + }); + connect(runControl, &RunControl::started, this, [] { + Debugger::showPermanentStatusMessage(Tr::tr("Function Profiler running...")); + }); connect(this, &CallgrindTool::dumpRequested, toolRunner, &CallgrindToolRunner::dump); connect(this, &CallgrindTool::resetRequested, toolRunner, &CallgrindToolRunner::reset); @@ -715,13 +735,6 @@ void CallgrindTool::setupRunner(CallgrindToolRunner *toolRunner) connect(m_stopAction, &QAction::triggered, toolRunner, [runControl] { runControl->initiateStop(); }); - // initialize run control - toolRunner->setPaused(m_pauseAction->isChecked()); - - // we may want to toggle collect for one function only in this run - toolRunner->setToggleCollectFunction(m_toggleCollectFunction); - m_toggleCollectFunction.clear(); - QTC_ASSERT(m_visualization, return); // apply project settings @@ -730,16 +743,6 @@ void CallgrindTool::setupRunner(CallgrindToolRunner *toolRunner) m_visualization->setMinimumInclusiveCostRatio(settings.visualizationMinimumInclusiveCostRatio() / 100.0); m_proxyModel.setMinimumInclusiveCostRatio(settings.minimumInclusiveCostRatio() / 100.0); m_dataModel.setVerboseToolTipsEnabled(settings.enableEventToolTips()); - - m_toolBusy = true; - updateRunActions(); - - // enable/disable actions - m_resetAction->setEnabled(true); - m_dumpAction->setEnabled(true); - m_loadExternalLogFile->setEnabled(false); - clearTextMarks(); - doClear(); } void CallgrindTool::updateRunActions()