Valgrind: Add gui option "Detect self-modifying code"

Setting this option to e.g. "Everywhere Except in File-backend Mappings"
allows to 'valgrind' Qt Creator itself.

Without that option the valgrind process will die if certain code paths
are executed.

Change-Id: I8888456d324a25ce092f0b0128407adf2159f496
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Nikolai Kosjar
2013-09-06 16:33:48 +02:00
committed by hjk
parent 00de61a79c
commit 548319c523
6 changed files with 213 additions and 105 deletions

View File

@@ -106,7 +106,7 @@ bool ValgrindRunControl::startEngine()
if (!sp.analyzerCmdPrefix.isEmpty())
valgrindExe = sp.analyzerCmdPrefix + QLatin1Char(' ') + valgrindExe;
run->setValgrindExecutable(valgrindExe);
run->setValgrindArguments(toolArguments());
run->setValgrindArguments(genericToolArguments() + toolArguments());
run->setDebuggeeExecutable(sp.debuggee);
run->setDebuggeeArguments(sp.debuggeeArgs);
run->setEnvironment(sp.environment);
@@ -137,6 +137,28 @@ QString ValgrindRunControl::executable() const
return startParameters().debuggee;
}
QStringList ValgrindRunControl::genericToolArguments() const
{
QTC_ASSERT(m_settings, return QStringList());
QString smcCheckValue;
switch (m_settings->selfModifyingCodeDetection()) {
case ValgrindBaseSettings::DetectSmcNo:
smcCheckValue = QLatin1String("none");
break;
case ValgrindBaseSettings::DetectSmcEverywhere:
smcCheckValue = QLatin1String("all");
break;
case ValgrindBaseSettings::DetectSmcEverywhereButFile:
smcCheckValue = QLatin1String("all-non-file");
break;
case ValgrindBaseSettings::DetectSmcStackOnly:
default:
smcCheckValue = QLatin1String("stack");
break;
}
return QStringList() << QLatin1String("--smc-check=") + smcCheckValue;
}
void ValgrindRunControl::handleProgressCanceled()
{
AnalyzerManager::stopTool();