forked from qt-creator/qt-creator
Valgrind: Strip QLatin1*
Change-Id: If93ca890ab6d023ab786a5153f50a1dfa03764de Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
7096649fc2
commit
2c212d48a5
@@ -46,7 +46,7 @@ using namespace Utils;
|
||||
namespace Valgrind {
|
||||
namespace Callgrind {
|
||||
|
||||
const QLatin1String CALLGRIND_CONTROL_BINARY("callgrind_control");
|
||||
const char CALLGRIND_CONTROL_BINARY[] = "callgrind_control";
|
||||
|
||||
CallgrindController::CallgrindController()
|
||||
{
|
||||
@@ -229,7 +229,7 @@ void CallgrindController::getLocalDataFile()
|
||||
const QStringList outputFiles = dir.entryList();
|
||||
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
|
||||
if (!outputFiles.isEmpty())
|
||||
fileName = workingDir + QLatin1Char('/') + outputFiles.first();
|
||||
fileName = workingDir + '/' + outputFiles.first();
|
||||
|
||||
emit localParseDataAvailable(fileName);
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ QModelIndex DataModel::indexForObject(const Function *function) const
|
||||
static QString noWrap(const QString &str)
|
||||
{
|
||||
QString escapedStr = str;
|
||||
return escapedStr.replace(QLatin1Char('-'), QLatin1String("‑"));
|
||||
return escapedStr.replace('-', "‑");
|
||||
}
|
||||
|
||||
static QString shortenTemplate(QString str)
|
||||
@@ -219,16 +219,16 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
||||
if (!d->m_verboseToolTips)
|
||||
return data(index, Qt::DisplayRole);
|
||||
|
||||
QString ret = QLatin1String("<html><head><style>\
|
||||
dt { font-weight: bold; }\
|
||||
dd { font-family: monospace; }\
|
||||
tr.head, td.head { font-weight: bold; }\
|
||||
tr.head { text-decoration: underline; }\
|
||||
td.group { padding-left: 20px; }\
|
||||
td { white-space: nowrap; }\
|
||||
</style></head>\n<body><dl>");
|
||||
QString ret = "<html><head><style>\n"
|
||||
"dt { font-weight: bold; }\n"
|
||||
"dd { font-family: monospace; }\n"
|
||||
"tr.head, td.head { font-weight: bold; }\n"
|
||||
"tr.head { text-decoration: underline; }\n"
|
||||
"td.group { padding-left: 20px; }\n"
|
||||
"td { white-space: nowrap; }\n"
|
||||
"</style></head>\n<body><dl>\n";
|
||||
|
||||
QString entry = QLatin1String("<dt>%1</dt><dd>%2</dd>\n");
|
||||
QString entry = "<dt>%1</dt><dd>%2</dd>\n";
|
||||
// body, function info first
|
||||
ret += entry.arg(tr("Function:")).arg(func->name().toHtmlEscaped());
|
||||
ret += entry.arg(tr("File:")).arg(func->file());
|
||||
@@ -241,17 +241,17 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
ret += entry.arg(tr("Object:")).arg(func->object());
|
||||
ret += entry.arg(tr("Called:")).arg(tr("%n time(s)", 0, func->called()));
|
||||
ret += QLatin1String("</dl><p/>");
|
||||
ret += "</dl><p/>";
|
||||
|
||||
// self/inclusive costs
|
||||
entry = QLatin1String("<td class='group'>%1</td><td>%2</td>");
|
||||
ret += QLatin1String("<table>");
|
||||
ret += QLatin1String("<thead><tr class='head'>");
|
||||
ret += QLatin1String("<td>") + tr("Events") + QLatin1String("</td>");
|
||||
entry = "<td class='group'>%1</td><td>%2</td>";
|
||||
ret += "<table>";
|
||||
ret += "<thead><tr class='head'>";
|
||||
ret += "<td>" + tr("Events") + "</td>";
|
||||
ret += entry.arg(tr("Self costs")).arg(tr("(%)"));
|
||||
ret += entry.arg(tr("Incl. costs")).arg(tr("(%)"));
|
||||
ret += QLatin1String("</tr></thead>");
|
||||
ret += QLatin1String("<tbody>");
|
||||
ret += "</tr></thead>";
|
||||
ret += "<tbody>";
|
||||
for (int i = 0; i < d->m_data->events().size(); ++i) {
|
||||
quint64 selfCost = func->selfCost(i);
|
||||
quint64 inclCost = func->inclusiveCost(i);
|
||||
@@ -260,16 +260,16 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
|
||||
const float relSelfCost = (float)qRound((float)selfCost / totalCost * 10000) / 100;
|
||||
const float relInclCost = (float)qRound((float)inclCost / totalCost * 10000) / 100;
|
||||
|
||||
ret += QLatin1String("<tr>");
|
||||
ret += QLatin1String("<td class='head'><nobr>") +
|
||||
ret += "<tr>";
|
||||
ret += "<td class='head'><nobr>" +
|
||||
noWrap(ParseData::prettyStringForEvent(d->m_data->events().at(i)))
|
||||
+ QLatin1String("</nobr></td>");
|
||||
+ "</nobr></td>";
|
||||
ret += entry.arg(selfCost).arg(tr("(%1%)").arg(relSelfCost));
|
||||
ret += entry.arg(inclCost).arg(tr("(%1%)").arg(relInclCost));
|
||||
ret += QLatin1String("</tr>");
|
||||
ret += "</tr>";
|
||||
}
|
||||
ret += QLatin1String("</tbody></table>");
|
||||
ret += QLatin1String("</body></html>");
|
||||
ret += "</tbody></table>";
|
||||
ret += "</body></html>";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -200,7 +200,7 @@ QString Function::location() const
|
||||
QString o = object();
|
||||
if (o.isEmpty())
|
||||
return QString();
|
||||
if (f.isEmpty() || f == QLatin1String("???"))
|
||||
if (f.isEmpty() || f == "???")
|
||||
return o;
|
||||
if (pos.isEmpty())
|
||||
return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o);
|
||||
|
@@ -166,19 +166,19 @@ QString ParseData::prettyStringForEvent(const QString &event)
|
||||
|
||||
QTC_ASSERT(event.size() >= 2, return event); // should not happen
|
||||
|
||||
const bool isMiss = event.contains(QLatin1Char('m')); // else hit
|
||||
const bool isRead = event.contains(QLatin1Char('r')); // else write
|
||||
const bool isMiss = event.contains('m'); // else hit
|
||||
const bool isRead = event.contains('r'); // else write
|
||||
|
||||
QString type;
|
||||
if (event.contains(QLatin1Char('L')))
|
||||
if (event.contains('L'))
|
||||
type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others
|
||||
else if (event.at(0) == QLatin1Char('I'))
|
||||
else if (event.at(0) == 'I')
|
||||
type = ParseData::Private::tr("Instruction");
|
||||
else if (event.at(0) == QLatin1Char('D'))
|
||||
else if (event.at(0) == 'D')
|
||||
type = ParseData::Private::tr("Cache");
|
||||
else if (event.leftRef(2) == QLatin1String("Bc"))
|
||||
else if (event.leftRef(2) == "Bc")
|
||||
type = ParseData::Private::tr("Conditional branches");
|
||||
else if (event.leftRef(2) == QLatin1String("Bi"))
|
||||
else if (event.leftRef(2) == "Bi")
|
||||
type = ParseData::Private::tr("Indirect branches");
|
||||
|
||||
QStringList prettyString;
|
||||
@@ -188,14 +188,14 @@ QString ParseData::prettyStringForEvent(const QString &event)
|
||||
prettyString << ParseData::Private::tr("level %1").arg(event.at(1));
|
||||
prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write"));
|
||||
|
||||
if (event.at(0) == QLatin1Char('B'))
|
||||
if (event.at(0) == 'B')
|
||||
prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed"));
|
||||
else
|
||||
prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access"));
|
||||
|
||||
// add original abbreviation
|
||||
prettyString << QLatin1Char('(') + event + QLatin1Char(')');
|
||||
return prettyString.join(QLatin1Char(' '));
|
||||
prettyString << '(' + event + ')';
|
||||
return prettyString.join(' ');
|
||||
}
|
||||
|
||||
QStringList ParseData::events() const
|
||||
@@ -211,9 +211,9 @@ void ParseData::setEvents(const QStringList &events)
|
||||
|
||||
QString ParseData::prettyStringForPosition(const QString &position)
|
||||
{
|
||||
if (position == QLatin1String("line"))
|
||||
if (position == "line")
|
||||
return ParseData::Private::tr("Line:"); // as in: "line number"
|
||||
else if (position == QLatin1String("instr"))
|
||||
else if (position == "instr")
|
||||
return ParseData::Private::tr("Instruction"); // as in: "instruction address"
|
||||
return ParseData::Private::tr("Position:"); // never reached, in theory
|
||||
}
|
||||
@@ -233,7 +233,7 @@ void ParseData::setPositions(const QStringList &positions)
|
||||
d->m_positions = positions;
|
||||
d->m_lineNumberPositionIndex = -1;
|
||||
for (int i = 0; i < positions.size(); ++i) {
|
||||
if (positions.at(i) == QLatin1String("line")) {
|
||||
if (positions.at(i) == "line") {
|
||||
d->m_lineNumberPositionIndex = i;
|
||||
break;
|
||||
}
|
||||
|
@@ -285,11 +285,11 @@ void Parser::Private::parseHeader(QIODevice *device)
|
||||
continue;
|
||||
} else if (line.startsWith("positions: ")) {
|
||||
QString values = getValue(line, 11);
|
||||
data->setPositions(values.split(QLatin1Char(' '), QString::SkipEmptyParts));
|
||||
data->setPositions(values.split(' ', QString::SkipEmptyParts));
|
||||
addressValuesCount = data->positions().count();
|
||||
} else if (line.startsWith("events: ")) {
|
||||
QString values = getValue(line, 8);
|
||||
data->setEvents(values.split(QLatin1Char(' '), QString::SkipEmptyParts));
|
||||
data->setEvents(values.split(' ', QString::SkipEmptyParts));
|
||||
costValuesCount = data->events().count();
|
||||
} else if (line.startsWith("version: ")) {
|
||||
QString value = getValue(line, 9);
|
||||
@@ -312,7 +312,7 @@ void Parser::Private::parseHeader(QIODevice *device)
|
||||
} else if (line.startsWith("summary: ")) {
|
||||
QString values = getValue(line, 9);
|
||||
uint i = 0;
|
||||
foreach (const QStringRef &value, values.splitRef(QLatin1Char(' '), QString::SkipEmptyParts))
|
||||
foreach (const QStringRef &value, values.splitRef(' ', QString::SkipEmptyParts))
|
||||
data->setTotalCost(i++, value.toULongLong());
|
||||
} else if (!line.trimmed().isEmpty()) {
|
||||
// handle line and exit parseHeader
|
||||
@@ -530,7 +530,7 @@ void Parser::Private::parseSourceFile(const char *begin, const char *end)
|
||||
|
||||
if (!name.second.isEmpty()) {
|
||||
data->addCompressedFile(name.second, name.first);
|
||||
if (name.second == QLatin1String("???"))
|
||||
if (name.second == "???")
|
||||
unknownFiles << name.first;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ void Parser::Private::parseDifferingSourceFile(const char *begin, const char *en
|
||||
|
||||
if (!name.second.isEmpty()) {
|
||||
data->addCompressedFile(name.second, name.first);
|
||||
if (name.second == QLatin1String("???"))
|
||||
if (name.second == "???")
|
||||
unknownFiles << name.first;
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ void Parser::Private::parseCalledSourceFile(const char *begin, const char *end)
|
||||
NamePair name = parseName(begin, end);
|
||||
if (!name.second.isEmpty()) {
|
||||
data->addCompressedFile(name.second, name.first);
|
||||
if (name.second == QLatin1String("???"))
|
||||
if (name.second == "???")
|
||||
unknownFiles << name.first;
|
||||
}
|
||||
|
||||
|
@@ -80,19 +80,19 @@ QStringList CallgrindToolRunner::toolArguments() const
|
||||
QTC_ASSERT(m_settings, return arguments);
|
||||
|
||||
if (m_settings->enableCacheSim())
|
||||
arguments << QLatin1String("--cache-sim=yes");
|
||||
arguments << "--cache-sim=yes";
|
||||
|
||||
if (m_settings->enableBranchSim())
|
||||
arguments << QLatin1String("--branch-sim=yes");
|
||||
arguments << "--branch-sim=yes";
|
||||
|
||||
if (m_settings->collectBusEvents())
|
||||
arguments << QLatin1String("--collect-bus=yes");
|
||||
arguments << "--collect-bus=yes";
|
||||
|
||||
if (m_settings->collectSystime())
|
||||
arguments << QLatin1String("--collect-systime=yes");
|
||||
arguments << "--collect-systime=yes";
|
||||
|
||||
if (m_markAsPaused)
|
||||
arguments << QLatin1String("--instr-atstart=no");
|
||||
arguments << "--instr-atstart=no";
|
||||
|
||||
// add extra arguments
|
||||
if (!m_argumentForToggleCollect.isEmpty())
|
||||
@@ -136,7 +136,7 @@ void CallgrindToolRunner::setToggleCollectFunction(const QString &toggleCollectF
|
||||
if (toggleCollectFunction.isEmpty())
|
||||
return;
|
||||
|
||||
m_argumentForToggleCollect = QLatin1String("--toggle-collect=") + toggleCollectFunction;
|
||||
m_argumentForToggleCollect = "--toggle-collect=" + toggleCollectFunction;
|
||||
}
|
||||
|
||||
void CallgrindToolRunner::reset()
|
||||
|
@@ -63,7 +63,7 @@ QString CallgrindHelper::toPercent(float costs, const QLocale &locale)
|
||||
return locale.toString(costs, 'f', 1) + locale.percent();
|
||||
if (costs > 0.009f)
|
||||
return locale.toString(costs, 'f', 2) + locale.percent();
|
||||
return QLatin1Char('<') + locale.toString(0.01f) + locale.percent();
|
||||
return '<' + locale.toString(0.01f) + locale.percent();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -220,7 +220,7 @@ public:
|
||||
|
||||
CallgrindTool::CallgrindTool()
|
||||
{
|
||||
setObjectName(QLatin1String("CallgrindTool"));
|
||||
setObjectName("CallgrindTool");
|
||||
|
||||
m_updateTimer.setInterval(200);
|
||||
m_updateTimer.setSingleShot(true);
|
||||
@@ -310,14 +310,14 @@ CallgrindTool::CallgrindTool()
|
||||
//
|
||||
m_visualization = new Visualization;
|
||||
m_visualization->setFrameStyle(QFrame::NoFrame);
|
||||
m_visualization->setObjectName(QLatin1String("Valgrind.CallgrindTool.Visualisation"));
|
||||
m_visualization->setObjectName("Valgrind.CallgrindTool.Visualisation");
|
||||
m_visualization->setWindowTitle(tr("Visualization"));
|
||||
m_visualization->setModel(&m_dataModel);
|
||||
connect(m_visualization, &Visualization::functionActivated,
|
||||
this, &CallgrindTool::visualisationFunctionSelected);
|
||||
|
||||
m_callersView = new CostView;
|
||||
m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView"));
|
||||
m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView");
|
||||
m_callersView->setWindowTitle(tr("Callers"));
|
||||
m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView");
|
||||
m_callersView->sortByColumn(CallModel::CostColumn);
|
||||
@@ -330,7 +330,7 @@ CallgrindTool::CallgrindTool()
|
||||
this, &CallgrindTool::callerFunctionSelected);
|
||||
|
||||
m_calleesView = new CostView;
|
||||
m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView"));
|
||||
m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView");
|
||||
m_calleesView->setWindowTitle(tr("Callees"));
|
||||
m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView");
|
||||
m_calleesView->sortByColumn(CallModel::CostColumn);
|
||||
@@ -343,7 +343,7 @@ CallgrindTool::CallgrindTool()
|
||||
this, &CallgrindTool::calleeFunctionSelected);
|
||||
|
||||
m_flatView = new CostView;
|
||||
m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView"));
|
||||
m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView");
|
||||
m_flatView->setWindowTitle(tr("Functions"));
|
||||
m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView");
|
||||
m_flatView->sortByColumn(DataModel::SelfCostColumn);
|
||||
@@ -461,7 +461,7 @@ CallgrindTool::CallgrindTool()
|
||||
auto button = new QToolButton;
|
||||
button->addActions(group->actions());
|
||||
button->setPopupMode(QToolButton::InstantPopup);
|
||||
button->setText(QLatin1String("$"));
|
||||
button->setText("$");
|
||||
button->setToolTip(tr("Cost Format"));
|
||||
m_perspective.addToolBarWidget(button);
|
||||
}
|
||||
@@ -469,15 +469,15 @@ CallgrindTool::CallgrindTool()
|
||||
ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings();
|
||||
|
||||
// Cycle detection
|
||||
//action = new QAction(QLatin1String("Cycle Detection"), this); ///FIXME: icon
|
||||
action = m_cycleDetection = new QAction(QLatin1String("O"), this); ///FIXME: icon
|
||||
//action = new QAction("Cycle Detection", this); ///FIXME: icon
|
||||
action = m_cycleDetection = new QAction("O", this); ///FIXME: icon
|
||||
action->setToolTip(tr("Enable cycle detection to properly handle recursive or circular function calls."));
|
||||
action->setCheckable(true);
|
||||
connect(action, &QAction::toggled, &m_dataModel, &DataModel::enableCycleDetection);
|
||||
connect(action, &QAction::toggled, settings, &ValgrindGlobalSettings::setDetectCycles);
|
||||
|
||||
// Shorter template signature
|
||||
action = m_shortenTemplates = new QAction(QLatin1String("<>"), this);
|
||||
action = m_shortenTemplates = new QAction("<>", this);
|
||||
action->setToolTip(tr("Remove template parameter lists when displaying function names."));
|
||||
action->setCheckable(true);
|
||||
connect(action, &QAction::toggled, &m_dataModel, &DataModel::setShortenTemplates);
|
||||
@@ -873,7 +873,7 @@ void CallgrindTool::handleShowCostsOfFunction()
|
||||
CPlusPlus::Overview view;
|
||||
const QString qualifiedFunctionName = view.prettyName(CPlusPlus::LookupContext::fullyQualifiedName(symbol));
|
||||
|
||||
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()");
|
||||
m_toggleCollectFunction = qualifiedFunctionName + "()";
|
||||
m_startAction->trigger();
|
||||
}
|
||||
|
||||
@@ -937,7 +937,7 @@ void CallgrindTool::createTextMarks()
|
||||
const QModelIndex index = m_dataModel.index(row, DataModel::InclusiveCostColumn);
|
||||
|
||||
QString fileName = index.data(DataModel::FileNameRole).toString();
|
||||
if (fileName.isEmpty() || fileName == QLatin1String("???"))
|
||||
if (fileName.isEmpty() || fileName == "???")
|
||||
continue;
|
||||
|
||||
bool ok = false;
|
||||
|
@@ -223,7 +223,7 @@ Visualization::Private::Private(Visualization *qq)
|
||||
, m_model(new DataProxyModel(qq))
|
||||
{
|
||||
// setup scene
|
||||
m_scene.setObjectName(QLatin1String("Visualisation Scene"));
|
||||
m_scene.setObjectName("Visualisation Scene");
|
||||
///NOTE: with size 100x100 the Qt-internal mouse selection fails...
|
||||
m_scene.setSceneRect(0, 0, 1024, 1024);
|
||||
|
||||
@@ -276,7 +276,7 @@ Visualization::Visualization(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
, d(new Private(this))
|
||||
{
|
||||
setObjectName(QLatin1String("Visualisation View"));
|
||||
setObjectName("Visualisation View");
|
||||
setScene(&d->m_scene);
|
||||
setRenderHint(QPainter::Antialiasing);
|
||||
}
|
||||
|
@@ -58,8 +58,8 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
||||
m_suppressAction = new QAction(this);
|
||||
m_suppressAction->setText(tr("Suppress Error"));
|
||||
const QIcon icon = Utils::Icon({
|
||||
{QLatin1String(":/utils/images/eye_open.png"), Utils::Theme::TextColorNormal},
|
||||
{QLatin1String(":/valgrind/images/suppressoverlay.png"), Utils::Theme::IconsErrorColor}},
|
||||
{":/utils/images/eye_open.png", Utils::Theme::TextColorNormal},
|
||||
{":/valgrind/images/suppressoverlay.png", Utils::Theme::IconsErrorColor}},
|
||||
Utils::Icon::Tint | Utils::Icon::PunchEdges).icon();
|
||||
m_suppressAction->setIcon(icon);
|
||||
m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete));
|
||||
|
@@ -276,8 +276,8 @@ static ErrorListModel::RelevantFrameFinder makeFrameFinder(const QStringList &pr
|
||||
|
||||
//if no frame belonging to the project was found, return the first one that is not malloc/new
|
||||
foreach (const Frame &frame, frames) {
|
||||
if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc")
|
||||
&& !frame.functionName().startsWith(QLatin1String("operator new(")))
|
||||
if (!frame.functionName().isEmpty() && frame.functionName() != "malloc"
|
||||
&& !frame.functionName().startsWith("operator new("))
|
||||
{
|
||||
return frame;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ MemcheckTool::MemcheckTool()
|
||||
{
|
||||
m_settings = ValgrindPlugin::globalSettings();
|
||||
|
||||
setObjectName(QLatin1String("MemcheckTool"));
|
||||
setObjectName("MemcheckTool");
|
||||
|
||||
m_filterProjectAction = new QAction(tr("External Errors"), this);
|
||||
m_filterProjectAction->setToolTip(
|
||||
@@ -539,7 +539,7 @@ MemcheckTool::MemcheckTool()
|
||||
m_errorFilterActions.append(a);
|
||||
|
||||
m_errorView = new MemcheckErrorView;
|
||||
m_errorView->setObjectName(QLatin1String("MemcheckErrorView"));
|
||||
m_errorView->setObjectName("MemcheckErrorView");
|
||||
m_errorView->setFrameStyle(QFrame::NoFrame);
|
||||
m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
m_errorModel.setRelevantFrameFinder(makeFrameFinder(QStringList()));
|
||||
@@ -551,7 +551,7 @@ MemcheckTool::MemcheckTool()
|
||||
m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_errorView->setAutoScroll(false);
|
||||
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView"));
|
||||
m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
|
||||
m_errorView->setWindowTitle(tr("Memory Issues"));
|
||||
|
||||
m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);
|
||||
|
@@ -79,7 +79,7 @@ static QString suppressionText(const Error &error)
|
||||
newName = frame.object();
|
||||
|
||||
if (!newName.isEmpty())
|
||||
sup.setName(newName + QLatin1Char('[') + sup.kind() + QLatin1Char(']'));
|
||||
sup.setName(newName + '[' + sup.kind() + ']');
|
||||
}
|
||||
|
||||
return sup.toString();
|
||||
@@ -129,7 +129,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
|
||||
suppressionsLabel->setBuddy(m_suppressionEdit);
|
||||
|
||||
QFont font;
|
||||
font.setFamily(QLatin1String("Monospace"));
|
||||
font.setFamily("Monospace");
|
||||
m_suppressionEdit->setFont(font);
|
||||
|
||||
m_buttonBox = new QDialogButtonBox(this);
|
||||
@@ -150,9 +150,9 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
|
||||
}
|
||||
|
||||
m_fileChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_fileChooser->setHistoryCompleter(QLatin1String("Valgrind.Suppression.History"));
|
||||
m_fileChooser->setHistoryCompleter("Valgrind.Suppression.History");
|
||||
m_fileChooser->setPath(defaultSuppFile.fileName());
|
||||
m_fileChooser->setPromptDialogFilter(QLatin1String("*.supp"));
|
||||
m_fileChooser->setPromptDialogFilter("*.supp");
|
||||
m_fileChooser->setPromptDialogTitle(tr("Select Suppression File"));
|
||||
|
||||
QString suppressions;
|
||||
|
@@ -52,7 +52,7 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings, bool
|
||||
m_model = new QStandardItemModel(this);
|
||||
|
||||
m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui->valgrindExeChooser->setHistoryCompleter(QLatin1String("Valgrind.Command.History"));
|
||||
m_ui->valgrindExeChooser->setHistoryCompleter("Valgrind.Command.History");
|
||||
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
|
||||
|
||||
updateUi();
|
||||
|
@@ -76,7 +76,7 @@ void ValgrindToolRunner::start()
|
||||
m_progress.reportStarted();
|
||||
|
||||
#if VALGRIND_DEBUG_OUTPUT
|
||||
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(QLatin1Char(' '))), DebugFormat);
|
||||
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), DebugFormat);
|
||||
emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat);
|
||||
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
|
||||
#endif
|
||||
@@ -126,17 +126,17 @@ QStringList ValgrindToolRunner::genericToolArguments() const
|
||||
QString smcCheckValue;
|
||||
switch (m_settings->selfModifyingCodeDetection()) {
|
||||
case ValgrindBaseSettings::DetectSmcNo:
|
||||
smcCheckValue = QLatin1String("none");
|
||||
smcCheckValue = "none";
|
||||
break;
|
||||
case ValgrindBaseSettings::DetectSmcEverywhere:
|
||||
smcCheckValue = QLatin1String("all");
|
||||
smcCheckValue = "all";
|
||||
break;
|
||||
case ValgrindBaseSettings::DetectSmcEverywhereButFile:
|
||||
smcCheckValue = QLatin1String("all-non-file");
|
||||
smcCheckValue = "all-non-file";
|
||||
break;
|
||||
case ValgrindBaseSettings::DetectSmcStackOnly:
|
||||
default:
|
||||
smcCheckValue = QLatin1String("stack");
|
||||
smcCheckValue = "stack";
|
||||
break;
|
||||
}
|
||||
return {"--smc-check=" + smcCheckValue};
|
||||
@@ -189,7 +189,7 @@ void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::P
|
||||
if (m_isStopping)
|
||||
return;
|
||||
|
||||
QObject *obj = ExtensionSystem::PluginManager::getObjectByName(QLatin1String("AppOutputPane"));
|
||||
QObject *obj = ExtensionSystem::PluginManager::getObjectByName("AppOutputPane");
|
||||
if (IOutputPane *pane = qobject_cast<IOutputPane *>(obj))
|
||||
pane->popup(IOutputPane::NoModeSwitch);
|
||||
}
|
||||
|
@@ -88,30 +88,30 @@ ValgrindBaseSettings::ValgrindBaseSettings(const ConfigWidgetCreator &creator)
|
||||
void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
||||
{
|
||||
// General
|
||||
setIfPresent(map, QLatin1String(valgrindExeC), &m_valgrindExecutable);
|
||||
setIfPresent(map, QLatin1String(selfModifyingCodeDetectionC),
|
||||
setIfPresent(map, valgrindExeC, &m_valgrindExecutable);
|
||||
setIfPresent(map, selfModifyingCodeDetectionC,
|
||||
(int*) &m_selfModifyingCodeDetection);
|
||||
|
||||
// Memcheck
|
||||
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers);
|
||||
setIfPresent(map, QLatin1String(leakCheckOnFinishC), (int*) &m_leakCheckOnFinish);
|
||||
setIfPresent(map, QLatin1String(showReachableC), &m_showReachable);
|
||||
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins);
|
||||
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues);
|
||||
if (map.contains(QLatin1String(visibleErrorKindsC))) {
|
||||
setIfPresent(map, numCallersC, &m_numCallers);
|
||||
setIfPresent(map, leakCheckOnFinishC, (int*) &m_leakCheckOnFinish);
|
||||
setIfPresent(map, showReachableC, &m_showReachable);
|
||||
setIfPresent(map, trackOriginsC, &m_trackOrigins);
|
||||
setIfPresent(map, filterExternalIssuesC, &m_filterExternalIssues);
|
||||
if (map.contains(visibleErrorKindsC)) {
|
||||
m_visibleErrorKinds.clear();
|
||||
foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList())
|
||||
foreach (const QVariant &val, map.value(visibleErrorKindsC).toList())
|
||||
m_visibleErrorKinds << val.toInt();
|
||||
}
|
||||
|
||||
// Callgrind
|
||||
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime);
|
||||
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents);
|
||||
setIfPresent(map, QLatin1String(callgrindEnableEventToolTipsC), &m_enableEventToolTips);
|
||||
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio);
|
||||
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
setIfPresent(map, callgrindEnableCacheSimC, &m_enableCacheSim);
|
||||
setIfPresent(map, callgrindEnableBranchSimC, &m_enableBranchSim);
|
||||
setIfPresent(map, callgrindCollectSystimeC, &m_collectSystime);
|
||||
setIfPresent(map, callgrindCollectBusEventsC, &m_collectBusEvents);
|
||||
setIfPresent(map, callgrindEnableEventToolTipsC, &m_enableEventToolTips);
|
||||
setIfPresent(map, callgrindMinimumCostRatioC, &m_minimumInclusiveCostRatio);
|
||||
setIfPresent(map, callgrindVisualisationMinimumCostRatioC,
|
||||
&m_visualisationMinimumInclusiveCostRatio);
|
||||
|
||||
emit changed();
|
||||
@@ -120,28 +120,28 @@ void ValgrindBaseSettings::fromMap(const QVariantMap &map)
|
||||
void ValgrindBaseSettings::toMap(QVariantMap &map) const
|
||||
{
|
||||
// General
|
||||
map.insert(QLatin1String(valgrindExeC), m_valgrindExecutable);
|
||||
map.insert(QLatin1String(selfModifyingCodeDetectionC), m_selfModifyingCodeDetection);
|
||||
map.insert(valgrindExeC, m_valgrindExecutable);
|
||||
map.insert(selfModifyingCodeDetectionC, m_selfModifyingCodeDetection);
|
||||
|
||||
// Memcheck
|
||||
map.insert(QLatin1String(numCallersC), m_numCallers);
|
||||
map.insert(QLatin1String(leakCheckOnFinishC), m_leakCheckOnFinish);
|
||||
map.insert(QLatin1String(showReachableC), m_showReachable);
|
||||
map.insert(QLatin1String(trackOriginsC), m_trackOrigins);
|
||||
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues);
|
||||
map.insert(numCallersC, m_numCallers);
|
||||
map.insert(leakCheckOnFinishC, m_leakCheckOnFinish);
|
||||
map.insert(showReachableC, m_showReachable);
|
||||
map.insert(trackOriginsC, m_trackOrigins);
|
||||
map.insert(filterExternalIssuesC, m_filterExternalIssues);
|
||||
QVariantList errorKinds;
|
||||
foreach (int i, m_visibleErrorKinds)
|
||||
errorKinds << i;
|
||||
map.insert(QLatin1String(visibleErrorKindsC), errorKinds);
|
||||
map.insert(visibleErrorKindsC, errorKinds);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim);
|
||||
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim);
|
||||
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime);
|
||||
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents);
|
||||
map.insert(QLatin1String(callgrindEnableEventToolTipsC), m_enableEventToolTips);
|
||||
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio);
|
||||
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC),
|
||||
map.insert(callgrindEnableCacheSimC, m_enableCacheSim);
|
||||
map.insert(callgrindEnableBranchSimC, m_enableBranchSim);
|
||||
map.insert(callgrindCollectSystimeC, m_collectSystime);
|
||||
map.insert(callgrindCollectBusEventsC, m_collectBusEvents);
|
||||
map.insert(callgrindEnableEventToolTipsC, m_enableEventToolTips);
|
||||
map.insert(callgrindMinimumCostRatioC, m_minimumInclusiveCostRatio);
|
||||
map.insert(callgrindVisualisationMinimumCostRatioC,
|
||||
m_visualisationMinimumInclusiveCostRatio);
|
||||
}
|
||||
|
||||
@@ -299,16 +299,16 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
m_suppressionFiles = map.value(QLatin1String(suppressionFilesC)).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(QLatin1String(lastSuppressionDirectoryC)).toString();
|
||||
m_lastSuppressionHistory = map.value(QLatin1String(lastSuppressionHistoryC)).toStringList();
|
||||
m_suppressionFiles = map.value(suppressionFilesC).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(lastSuppressionDirectoryC).toString();
|
||||
m_lastSuppressionHistory = map.value(lastSuppressionHistoryC).toStringList();
|
||||
|
||||
// Callgrind
|
||||
// special code as the default one does not cope with the enum properly
|
||||
if (map.contains(QLatin1String(callgrindCostFormatC)))
|
||||
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt());
|
||||
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles);
|
||||
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates);
|
||||
if (map.contains(callgrindCostFormatC))
|
||||
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(callgrindCostFormatC).toInt());
|
||||
setIfPresent(map, callgrindCycleDetectionC, &m_detectCycles);
|
||||
setIfPresent(map, callgrindShortenTemplates, &m_shortenTemplates);
|
||||
}
|
||||
|
||||
void ValgrindGlobalSettings::toMap(QVariantMap &map) const
|
||||
@@ -316,14 +316,14 @@ void ValgrindGlobalSettings::toMap(QVariantMap &map) const
|
||||
ValgrindBaseSettings::toMap(map);
|
||||
|
||||
// Memcheck
|
||||
map.insert(QLatin1String(suppressionFilesC), m_suppressionFiles);
|
||||
map.insert(QLatin1String(lastSuppressionDirectoryC), m_lastSuppressionDirectory);
|
||||
map.insert(QLatin1String(lastSuppressionHistoryC), m_lastSuppressionHistory);
|
||||
map.insert(suppressionFilesC, m_suppressionFiles);
|
||||
map.insert(lastSuppressionDirectoryC, m_lastSuppressionDirectory);
|
||||
map.insert(lastSuppressionHistoryC, m_lastSuppressionHistory);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
||||
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles);
|
||||
map.insert(QLatin1String(callgrindShortenTemplates), m_shortenTemplates);
|
||||
map.insert(callgrindCostFormatC, m_costFormat);
|
||||
map.insert(callgrindCycleDetectionC, m_detectCycles);
|
||||
map.insert(callgrindShortenTemplates, m_shortenTemplates);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -375,40 +375,40 @@ void ValgrindGlobalSettings::readSettings()
|
||||
QVariantMap defaults;
|
||||
|
||||
// General
|
||||
defaults.insert(QLatin1String(valgrindExeC), QLatin1String("valgrind"));
|
||||
defaults.insert(QLatin1String(selfModifyingCodeDetectionC), DetectSmcStackOnly);
|
||||
defaults.insert(valgrindExeC, "valgrind");
|
||||
defaults.insert(selfModifyingCodeDetectionC, DetectSmcStackOnly);
|
||||
|
||||
// Memcheck
|
||||
defaults.insert(QLatin1String(numCallersC), 25);
|
||||
defaults.insert(QLatin1String(leakCheckOnFinishC), LeakCheckOnFinishSummaryOnly);
|
||||
defaults.insert(QLatin1String(showReachableC), false);
|
||||
defaults.insert(QLatin1String(trackOriginsC), true);
|
||||
defaults.insert(QLatin1String(filterExternalIssuesC), true);
|
||||
defaults.insert(numCallersC, 25);
|
||||
defaults.insert(leakCheckOnFinishC, LeakCheckOnFinishSummaryOnly);
|
||||
defaults.insert(showReachableC, false);
|
||||
defaults.insert(trackOriginsC, true);
|
||||
defaults.insert(filterExternalIssuesC, true);
|
||||
QVariantList defaultErrorKinds;
|
||||
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
|
||||
defaultErrorKinds << i;
|
||||
defaults.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds);
|
||||
defaults.insert(visibleErrorKindsC, defaultErrorKinds);
|
||||
|
||||
defaults.insert(QLatin1String(suppressionFilesC), QStringList());
|
||||
defaults.insert(QLatin1String(lastSuppressionDirectoryC), QString());
|
||||
defaults.insert(QLatin1String(lastSuppressionHistoryC), QStringList());
|
||||
defaults.insert(suppressionFilesC, QStringList());
|
||||
defaults.insert(lastSuppressionDirectoryC, QString());
|
||||
defaults.insert(lastSuppressionHistoryC, QStringList());
|
||||
|
||||
// Callgrind
|
||||
defaults.insert(QLatin1String(callgrindEnableCacheSimC), false);
|
||||
defaults.insert(QLatin1String(callgrindEnableBranchSimC), false);
|
||||
defaults.insert(QLatin1String(callgrindCollectSystimeC), false);
|
||||
defaults.insert(QLatin1String(callgrindCollectBusEventsC), false);
|
||||
defaults.insert(QLatin1String(callgrindEnableEventToolTipsC), true);
|
||||
defaults.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01);
|
||||
defaults.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0);
|
||||
defaults.insert(callgrindEnableCacheSimC, false);
|
||||
defaults.insert(callgrindEnableBranchSimC, false);
|
||||
defaults.insert(callgrindCollectSystimeC, false);
|
||||
defaults.insert(callgrindCollectBusEventsC, false);
|
||||
defaults.insert(callgrindEnableEventToolTipsC, true);
|
||||
defaults.insert(callgrindMinimumCostRatioC, 0.01);
|
||||
defaults.insert(callgrindVisualisationMinimumCostRatioC, 10.0);
|
||||
|
||||
defaults.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||
defaults.insert(QLatin1String(callgrindCycleDetectionC), true);
|
||||
defaults.insert(QLatin1String(callgrindShortenTemplates), true);
|
||||
defaults.insert(callgrindCostFormatC, CostDelegate::FormatRelative);
|
||||
defaults.insert(callgrindCycleDetectionC, true);
|
||||
defaults.insert(callgrindShortenTemplates, true);
|
||||
|
||||
// Read stored values
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
settings->beginGroup(QLatin1String(groupC));
|
||||
settings->beginGroup(groupC);
|
||||
QVariantMap map = defaults;
|
||||
for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it)
|
||||
map.insert(it.key(), settings->value(it.key(), it.value()));
|
||||
@@ -420,7 +420,7 @@ void ValgrindGlobalSettings::readSettings()
|
||||
void ValgrindGlobalSettings::writeSettings() const
|
||||
{
|
||||
QSettings *settings = Core::ICore::settings();
|
||||
settings->beginGroup(QLatin1String(groupC));
|
||||
settings->beginGroup(groupC);
|
||||
QVariantMap map;
|
||||
toMap(map);
|
||||
for (QVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
|
||||
@@ -480,8 +480,8 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
setIfPresent(map, QLatin1String(addedSuppressionFilesC), &m_addedSuppressionFiles);
|
||||
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles);
|
||||
setIfPresent(map, addedSuppressionFilesC, &m_addedSuppressionFiles);
|
||||
setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
|
||||
}
|
||||
|
||||
void ValgrindProjectSettings::toMap(QVariantMap &map) const
|
||||
@@ -489,8 +489,8 @@ void ValgrindProjectSettings::toMap(QVariantMap &map) const
|
||||
ValgrindBaseSettings::toMap(map);
|
||||
|
||||
// Memcheck
|
||||
map.insert(QLatin1String(addedSuppressionFilesC), m_addedSuppressionFiles);
|
||||
map.insert(QLatin1String(removedSuppressionFilesC), m_disabledGlobalSuppressionFiles);
|
||||
map.insert(addedSuppressionFilesC, m_addedSuppressionFiles);
|
||||
map.insert(removedSuppressionFilesC, m_disabledGlobalSuppressionFiles);
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -63,7 +63,7 @@ static bool on64bit()
|
||||
|
||||
static QString srcDirForApp(const QString &app)
|
||||
{
|
||||
return QDir::cleanPath(appSrcDir + QLatin1Char('/') + app);
|
||||
return QDir::cleanPath(appSrcDir + '/' + app);
|
||||
}
|
||||
|
||||
ValgrindTestRunnerTest::ValgrindTestRunnerTest(QObject *parent)
|
||||
@@ -147,7 +147,7 @@ void ValgrindTestRunnerTest::init()
|
||||
|
||||
void ValgrindTestRunnerTest::testLeak1()
|
||||
{
|
||||
const QString binary = runTestBinary(QLatin1String("leak1/leak1"));
|
||||
const QString binary = runTestBinary("leak1/leak1");
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -166,24 +166,24 @@ void ValgrindTestRunnerTest::testLeak1()
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
if (on64bit())
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned long)");
|
||||
else
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned int)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 5 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak1"));
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindTestRunnerTest::testLeak2()
|
||||
{
|
||||
const QString binary = runTestBinary(QLatin1String("leak2/leak2"));
|
||||
const QString binary = runTestBinary("leak2/leak2");
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -200,30 +200,30 @@ void ValgrindTestRunnerTest::testLeak2()
|
||||
QCOMPARE(stack.frames().count(), 3);
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("malloc"));
|
||||
QCOMPARE(frame.functionName(), "malloc");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("strdup"));
|
||||
QCOMPARE(frame.functionName(), "strdup");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(2);
|
||||
if (on64bit()) {
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak2"));
|
||||
} else {
|
||||
QCOMPARE(frame.functionName(), QLatin1String("(below main)"));
|
||||
QCOMPARE(frame.functionName(), "(below main)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ValgrindTestRunnerTest::testLeak3()
|
||||
{
|
||||
const QString binary = runTestBinary(QLatin1String("leak3/leak3"), QStringList() << "--show-reachable=yes");
|
||||
const QString binary = runTestBinary("leak3/leak3", QStringList{"--show-reachable=yes"});
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -240,23 +240,23 @@ void ValgrindTestRunnerTest::testLeak3()
|
||||
QCOMPARE(stack.frames().count(), 3);
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("malloc"));
|
||||
QCOMPARE(frame.functionName(), "malloc");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("strdup"));
|
||||
QCOMPARE(frame.functionName(), "strdup");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(2);
|
||||
if (on64bit()) {
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak3"));
|
||||
} else {
|
||||
QCOMPARE(frame.functionName(), QLatin1String("(below main)"));
|
||||
QCOMPARE(frame.functionName(), "(below main)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void ValgrindTestRunnerTest::testLeak3()
|
||||
void ValgrindTestRunnerTest::testLeak4()
|
||||
{
|
||||
const QString app("leak4");
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app,
|
||||
const QString binary = runTestBinary(app + '/' + app,
|
||||
QStringList() << "--show-reachable=yes");
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
@@ -290,26 +290,26 @@ void ValgrindTestRunnerTest::testLeak4()
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
if (on64bit())
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned long)");
|
||||
else
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned int)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("Foo::Foo()"));
|
||||
QCOMPARE(frame.functionName(), "Foo::Foo()");
|
||||
QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(2);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 14 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -331,17 +331,17 @@ void ValgrindTestRunnerTest::testLeak4()
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
if (on64bit())
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned long)");
|
||||
else
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned int)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 14 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -350,7 +350,7 @@ void ValgrindTestRunnerTest::testLeak4()
|
||||
void ValgrindTestRunnerTest::testUninit1()
|
||||
{
|
||||
const QString app("uninit1");
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -369,11 +369,11 @@ void ValgrindTestRunnerTest::testUninit1()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
//BEGIN second stack
|
||||
@@ -383,11 +383,11 @@ void ValgrindTestRunnerTest::testUninit1()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -396,7 +396,7 @@ void ValgrindTestRunnerTest::testUninit2()
|
||||
{
|
||||
const QString app("uninit2");
|
||||
m_expectCrash = true;
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -417,11 +417,11 @@ void ValgrindTestRunnerTest::testUninit2()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
//BEGIN second stack
|
||||
@@ -431,11 +431,11 @@ void ValgrindTestRunnerTest::testUninit2()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -450,11 +450,11 @@ void ValgrindTestRunnerTest::testUninit2()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,7 @@ void ValgrindTestRunnerTest::testUninit3()
|
||||
{
|
||||
const QString app("uninit3");
|
||||
m_expectCrash = true;
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -484,11 +484,11 @@ void ValgrindTestRunnerTest::testUninit3()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
//BEGIN second stack
|
||||
@@ -498,11 +498,11 @@ void ValgrindTestRunnerTest::testUninit3()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -517,11 +517,11 @@ void ValgrindTestRunnerTest::testUninit3()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ void ValgrindTestRunnerTest::testUninit3()
|
||||
void ValgrindTestRunnerTest::testSyscall()
|
||||
{
|
||||
const QString app("syscall");
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -550,25 +550,25 @@ void ValgrindTestRunnerTest::testSyscall()
|
||||
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("_Exit"));
|
||||
QCOMPARE(frame.functionName(), "_Exit");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("__run_exit_handlers"));
|
||||
QCOMPARE(frame.functionName(), "__run_exit_handlers");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(2);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("exit"));
|
||||
QCOMPARE(frame.functionName(), "exit");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(3);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("(below main)"));
|
||||
QCOMPARE(frame.functionName(), "(below main)");
|
||||
}
|
||||
} else {
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("_Exit"));
|
||||
QCOMPARE(frame.functionName(), "_Exit");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -579,11 +579,11 @@ void ValgrindTestRunnerTest::testSyscall()
|
||||
QCOMPARE(stack.frames().count(), 1);
|
||||
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -591,7 +591,7 @@ void ValgrindTestRunnerTest::testSyscall()
|
||||
void ValgrindTestRunnerTest::testFree1()
|
||||
{
|
||||
const QString app("free1");
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -611,15 +611,15 @@ void ValgrindTestRunnerTest::testFree1()
|
||||
|
||||
{
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)"));
|
||||
QCOMPARE(frame.functionName(), "operator delete(void*)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().last();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -631,15 +631,15 @@ void ValgrindTestRunnerTest::testFree1()
|
||||
|
||||
{
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)"));
|
||||
QCOMPARE(frame.functionName(), "operator delete(void*)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().last();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -648,7 +648,7 @@ void ValgrindTestRunnerTest::testFree1()
|
||||
void ValgrindTestRunnerTest::testFree2()
|
||||
{
|
||||
const QString app("free2");
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -668,15 +668,15 @@ void ValgrindTestRunnerTest::testFree2()
|
||||
|
||||
{
|
||||
const Frame frame = stack.frames().first();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("free"));
|
||||
QCOMPARE(frame.functionName(), "free");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().last();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -690,17 +690,17 @@ void ValgrindTestRunnerTest::testFree2()
|
||||
{
|
||||
const Frame frame = stack.frames().first();
|
||||
if (on64bit())
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned long)");
|
||||
else
|
||||
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)"));
|
||||
QCOMPARE(frame.functionName(), "operator new(unsigned int)");
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().last();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 5 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ void ValgrindTestRunnerTest::testInvalidjump()
|
||||
{
|
||||
const QString app("invalidjump");
|
||||
m_expectCrash = true;
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -731,7 +731,7 @@ void ValgrindTestRunnerTest::testInvalidjump()
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().at(1);
|
||||
QCOMPARE(frame.functionName(), QLatin1String("(below main)"));
|
||||
QCOMPARE(frame.functionName(), "(below main)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ void ValgrindTestRunnerTest::testOverlap()
|
||||
{
|
||||
const QString app("overlap");
|
||||
m_expectCrash = true;
|
||||
const QString binary = runTestBinary(app + QLatin1Char('/') + app);
|
||||
const QString binary = runTestBinary(app + '/' + app);
|
||||
if (binary.isEmpty())
|
||||
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
|
||||
"manually before executing this test.");
|
||||
@@ -756,15 +756,15 @@ void ValgrindTestRunnerTest::testOverlap()
|
||||
QCOMPARE(stack.frames().count(), 2);
|
||||
{
|
||||
const Frame frame = stack.frames().at(0);
|
||||
QVERIFY(frame.functionName().startsWith(QLatin1String("memcpy")));
|
||||
QVERIFY(frame.functionName().startsWith("memcpy"));
|
||||
}
|
||||
{
|
||||
const Frame frame = stack.frames().last();
|
||||
QCOMPARE(frame.functionName(), QLatin1String("main"));
|
||||
QCOMPARE(frame.functionName(), "main");
|
||||
QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
|
||||
|
||||
QCOMPARE(frame.object(), binary);
|
||||
QCOMPARE(frame.fileName(), QLatin1String("main.cpp"));
|
||||
QCOMPARE(frame.fileName(), "main.cpp");
|
||||
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
|
||||
}
|
||||
}
|
||||
|
@@ -121,7 +121,7 @@ static QString makeFrameName(const Frame &frame, bool withLocation)
|
||||
path = QFileInfo(path).canonicalFilePath();
|
||||
|
||||
if (frame.line() != -1)
|
||||
path += QLatin1Char(':') + QString::number(frame.line());
|
||||
path += ':' + QString::number(frame.line());
|
||||
|
||||
if (!fn.isEmpty()) {
|
||||
const QString location = withLocation || path == frame.object()
|
||||
@@ -274,7 +274,7 @@ QVariant FrameItem::data(int column, int role) const
|
||||
const int padding = static_cast<int>(std::log10(parent()->childCount()))
|
||||
- static_cast<int>(std::log10(row));
|
||||
return QString::fromLatin1("%1%2: %3")
|
||||
.arg(QString(padding, QLatin1Char(' ')))
|
||||
.arg(QString(padding, ' '))
|
||||
.arg(row)
|
||||
.arg(makeFrameName(m_frame, false));
|
||||
}
|
||||
|
@@ -145,7 +145,7 @@ QString Frame::filePath() const
|
||||
{
|
||||
QString f;
|
||||
if (!directory().isEmpty())
|
||||
f.append(directory()).append(QLatin1Char('/'));
|
||||
f.append(directory()).append('/');
|
||||
return f.append(fileName());
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ QString toolTipForFrame(const Frame &frame)
|
||||
if (!frame.fileName().isEmpty()) {
|
||||
location = frame.filePath();
|
||||
if (frame.line() > 0)
|
||||
location += QLatin1Char(':') + QString::number(frame.line());
|
||||
location += ':' + QString::number(frame.line());
|
||||
}
|
||||
|
||||
typedef QPair<QString, QString> StringPair;
|
||||
@@ -60,19 +60,18 @@ QString toolTipForFrame(const Frame &frame)
|
||||
if (!frame.object().isEmpty())
|
||||
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
|
||||
|
||||
QString html = QLatin1String("<html>"
|
||||
"<head>"
|
||||
QString html = "<html><head>"
|
||||
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
|
||||
"<body><dl>");
|
||||
"</head><body><dl>";
|
||||
|
||||
foreach (const StringPair &pair, lines) {
|
||||
html += QLatin1String("<dt>");
|
||||
html += "<dt>";
|
||||
html += pair.first;
|
||||
html += QLatin1String("</dt><dd>");
|
||||
html += "</dt><dd>";
|
||||
html += pair.second;
|
||||
html += QLatin1String("</dd>\n");
|
||||
html += "</dd>\n";
|
||||
}
|
||||
html += QLatin1String("</dl></body></html>");
|
||||
html += "</dl></body></html>";
|
||||
return html;
|
||||
}
|
||||
|
||||
|
@@ -128,17 +128,17 @@ private:
|
||||
};
|
||||
|
||||
#undef ADD_ENUM
|
||||
#define ADD_ENUM(tool,enumV) { errorKindsByName_##tool.insert(QLatin1String(#enumV), enumV); }
|
||||
#define ADD_ENUM(tool,enumV) { errorKindsByName_##tool.insert(#enumV, enumV); }
|
||||
|
||||
|
||||
Parser::Private::Private(Parser *qq)
|
||||
: q(qq)
|
||||
{
|
||||
tool = Parser::Unknown;
|
||||
toolsByName.insert(QLatin1String("memcheck"), Parser::Memcheck);
|
||||
toolsByName.insert(QLatin1String("ptrcheck"), Parser::Ptrcheck);
|
||||
toolsByName.insert(QLatin1String("exp-ptrcheck"), Parser::Ptrcheck);
|
||||
toolsByName.insert(QLatin1String("helgrind"), Parser::Helgrind);
|
||||
toolsByName.insert("memcheck", Parser::Memcheck);
|
||||
toolsByName.insert("ptrcheck", Parser::Ptrcheck);
|
||||
toolsByName.insert("exp-ptrcheck", Parser::Ptrcheck);
|
||||
toolsByName.insert("helgrind", Parser::Helgrind);
|
||||
|
||||
ADD_ENUM(memcheck, ClientCheck)
|
||||
ADD_ENUM(memcheck, InvalidFree)
|
||||
@@ -306,14 +306,14 @@ XWhat Parser::Private::parseXWhat()
|
||||
if (reader.isEndElement())
|
||||
break;
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("text"))
|
||||
if (name == "text")
|
||||
what.text = blockingReadElementText();
|
||||
else if (name == QLatin1String("leakedbytes"))
|
||||
what.leakedbytes = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedbytes"));
|
||||
else if (name == QLatin1String("leakedblocks"))
|
||||
what.leakedblocks = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedblocks"));
|
||||
else if (name == QLatin1String("hthreadid"))
|
||||
what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/hthreadid"));
|
||||
else if (name == "leakedbytes")
|
||||
what.leakedbytes = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedbytes");
|
||||
else if (name == "leakedblocks")
|
||||
what.leakedblocks = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedblocks");
|
||||
else if (name == "hthreadid")
|
||||
what.hthreadid = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/hthreadid");
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -328,16 +328,16 @@ XauxWhat Parser::Private::parseXauxWhat()
|
||||
if (reader.isEndElement())
|
||||
break;
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("text"))
|
||||
if (name == "text")
|
||||
what.text = blockingReadElementText();
|
||||
else if (name == QLatin1String("file"))
|
||||
else if (name == "file")
|
||||
what.file = blockingReadElementText();
|
||||
else if (name == QLatin1String("dir"))
|
||||
else if (name == "dir")
|
||||
what.dir = blockingReadElementText();
|
||||
else if (name == QLatin1String("line"))
|
||||
what.line = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/line"));
|
||||
else if (name == QLatin1String("hthreadid"))
|
||||
what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/hthreadid"));
|
||||
else if (name == "line")
|
||||
what.line = parseInt64(blockingReadElementText(), "error/xauxwhat/line");
|
||||
else if (name == "hthreadid")
|
||||
what.hthreadid = parseInt64(blockingReadElementText(), "error/xauxwhat/hthreadid");
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -395,9 +395,9 @@ int Parser::Private::parseErrorKind(const QString &kind)
|
||||
|
||||
static Status::State parseState(const QString &state)
|
||||
{
|
||||
if (state == QLatin1String("RUNNING"))
|
||||
if (state == "RUNNING")
|
||||
return Status::Running;
|
||||
if (state == QLatin1String("FINISHED"))
|
||||
if (state == "FINISHED")
|
||||
return Status::Finished;
|
||||
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
|
||||
"Unknown state \"%1\"").arg(state));
|
||||
@@ -436,27 +436,27 @@ void Parser::Private::parseError()
|
||||
if (reader.isStartElement())
|
||||
lastAuxWhat++;
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("unique")) {
|
||||
e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique")));
|
||||
} else if (name == QLatin1String("tid")) {
|
||||
e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid")));
|
||||
} else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific:
|
||||
if (name == "unique") {
|
||||
e.setUnique(parseHex(blockingReadElementText(), "unique"));
|
||||
} else if (name == "tid") {
|
||||
e.setTid(parseInt64(blockingReadElementText(), "error/tid"));
|
||||
} else if (name == "kind") { //TODO this is memcheck-specific:
|
||||
e.setKind(parseErrorKind(blockingReadElementText()));
|
||||
} else if (name == QLatin1String("suppression")) {
|
||||
} else if (name == "suppression") {
|
||||
e.setSuppression(parseSuppression());
|
||||
} else if (name == QLatin1String("xwhat")) {
|
||||
} else if (name == "xwhat") {
|
||||
const XWhat xw = parseXWhat();
|
||||
e.setWhat(xw.text);
|
||||
e.setLeakedBlocks(xw.leakedblocks);
|
||||
e.setLeakedBytes(xw.leakedbytes);
|
||||
e.setHelgrindThreadId(xw.hthreadid);
|
||||
} else if (name == QLatin1String("what")) {
|
||||
} else if (name == "what") {
|
||||
e.setWhat(blockingReadElementText());
|
||||
} else if (name == QLatin1String("xauxwhat")) {
|
||||
} else if (name == "xauxwhat") {
|
||||
if (!currentAux.text.isEmpty())
|
||||
auxs.push_back(currentAux);
|
||||
currentAux = parseXauxWhat();
|
||||
} else if (name == QLatin1String("auxwhat")) {
|
||||
} else if (name == "auxwhat") {
|
||||
const QString aux = blockingReadElementText();
|
||||
//concatenate multiple consecutive <auxwhat> tags
|
||||
if (lastAuxWhat > 1) {
|
||||
@@ -466,11 +466,11 @@ void Parser::Private::parseError()
|
||||
currentAux.text = aux;
|
||||
} else {
|
||||
if (!currentAux.text.isEmpty())
|
||||
currentAux.text.append(QLatin1Char(' '));
|
||||
currentAux.text.append(' ');
|
||||
currentAux.text.append(aux);
|
||||
}
|
||||
lastAuxWhat = 0;
|
||||
} else if (name == QLatin1String("stack")) {
|
||||
} else if (name == "stack") {
|
||||
frames.push_back(parseStack());
|
||||
} else if (reader.isStartElement()) {
|
||||
reader.skipCurrentElement();
|
||||
@@ -507,18 +507,18 @@ Frame Parser::Private::parseFrame()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("ip"))
|
||||
frame.setInstructionPointer(parseHex(blockingReadElementText(), QLatin1String("error/frame/ip")));
|
||||
else if (name == QLatin1String("obj"))
|
||||
if (name == "ip")
|
||||
frame.setInstructionPointer(parseHex(blockingReadElementText(), "error/frame/ip"));
|
||||
else if (name == "obj")
|
||||
frame.setObject(blockingReadElementText());
|
||||
else if (name == QLatin1String("fn"))
|
||||
else if (name == "fn")
|
||||
frame.setFunctionName( blockingReadElementText());
|
||||
else if (name == QLatin1String("dir"))
|
||||
else if (name == "dir")
|
||||
frame.setDirectory(blockingReadElementText());
|
||||
else if (name == QLatin1String("file"))
|
||||
else if (name == "file")
|
||||
frame.setFileName(blockingReadElementText());
|
||||
else if (name == QLatin1String("line"))
|
||||
frame.setLine(parseInt64(blockingReadElementText(), QLatin1String("error/frame/line")));
|
||||
else if (name == "line")
|
||||
frame.setLine(parseInt64(blockingReadElementText(), "error/frame/line"));
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -537,9 +537,9 @@ void Parser::Private::parseAnnounceThread()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("hthreadid"))
|
||||
at.setHelgrindThreadId(parseInt64(blockingReadElementText(), QLatin1String("announcethread/hthreadid")));
|
||||
else if (name == QLatin1String("stack"))
|
||||
if (name == "hthreadid")
|
||||
at.setHelgrindThreadId(parseInt64(blockingReadElementText(), "announcethread/hthreadid"));
|
||||
else if (name == "stack")
|
||||
at.setStack(parseStack());
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
@@ -556,7 +556,7 @@ void Parser::Private::parseErrorCounts()
|
||||
if (reader.isEndElement())
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == QLatin1String("pair")) {
|
||||
if (reader.name() == "pair") {
|
||||
qint64 unique = 0;
|
||||
qint64 count = 0;
|
||||
while (notAtEnd()) {
|
||||
@@ -565,10 +565,10 @@ void Parser::Private::parseErrorCounts()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("unique"))
|
||||
unique = parseHex(blockingReadElementText(), QLatin1String("errorcounts/pair/unique"));
|
||||
else if (name == QLatin1String("count"))
|
||||
count = parseInt64(blockingReadElementText(), QLatin1String("errorcounts/pair/count"));
|
||||
if (name == "unique")
|
||||
unique = parseHex(blockingReadElementText(), "errorcounts/pair/unique");
|
||||
else if (name == "count")
|
||||
count = parseInt64(blockingReadElementText(), "errorcounts/pair/count");
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -589,7 +589,7 @@ void Parser::Private::parseSuppressionCounts()
|
||||
if (reader.isEndElement())
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == QLatin1String("pair")) {
|
||||
if (reader.name() == "pair") {
|
||||
QString pairName;
|
||||
qint64 count = 0;
|
||||
while (notAtEnd()) {
|
||||
@@ -598,10 +598,10 @@ void Parser::Private::parseSuppressionCounts()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("name"))
|
||||
if (name == "name")
|
||||
pairName = blockingReadElementText();
|
||||
else if (name == QLatin1String("count"))
|
||||
count = parseInt64(blockingReadElementText(), QLatin1String("suppcounts/pair/count"));
|
||||
else if (name == "count")
|
||||
count = parseInt64(blockingReadElementText(), "suppcounts/pair/count");
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -624,9 +624,9 @@ void Parser::Private::parseStatus()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("state"))
|
||||
if (name == "state")
|
||||
s.setState(parseState(blockingReadElementText()));
|
||||
else if (name == QLatin1String("time"))
|
||||
else if (name == "time")
|
||||
s.setTime(blockingReadElementText());
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
@@ -644,7 +644,7 @@ QVector<Frame> Parser::Private::parseStack()
|
||||
if (reader.isEndElement())
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
if (reader.name() == QLatin1String("frame"))
|
||||
if (reader.name() == "frame")
|
||||
frames.append(parseFrame());
|
||||
}
|
||||
}
|
||||
@@ -662,9 +662,9 @@ SuppressionFrame Parser::Private::parseSuppressionFrame()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("obj"))
|
||||
if (name == "obj")
|
||||
frame.setObject(blockingReadElementText());
|
||||
else if (name == QLatin1String("fun"))
|
||||
else if (name == "fun")
|
||||
frame.setFunction( blockingReadElementText());
|
||||
else if (reader.isStartElement())
|
||||
reader.skipCurrentElement();
|
||||
@@ -684,15 +684,15 @@ Suppression Parser::Private::parseSuppression()
|
||||
break;
|
||||
if (reader.isStartElement()) {
|
||||
const QStringRef name = reader.name();
|
||||
if (name == QLatin1String("sname"))
|
||||
if (name == "sname")
|
||||
supp.setName(blockingReadElementText());
|
||||
else if (name == QLatin1String("skind"))
|
||||
else if (name == "skind")
|
||||
supp.setKind(blockingReadElementText());
|
||||
else if (name == QLatin1String("skaux"))
|
||||
else if (name == "skaux")
|
||||
supp.setAuxKind(blockingReadElementText());
|
||||
else if (name == QLatin1String("rawtext"))
|
||||
else if (name == "rawtext")
|
||||
supp.setRawText(blockingReadElementText());
|
||||
else if (name == QLatin1String("sframe"))
|
||||
else if (name == "sframe")
|
||||
frames.push_back(parseSuppressionFrame());
|
||||
}
|
||||
}
|
||||
@@ -710,19 +710,19 @@ void Parser::Private::parse(QIODevice *device)
|
||||
while (notAtEnd()) {
|
||||
blockingReadNext();
|
||||
QStringRef name = reader.name();
|
||||
if (name == QLatin1String("error"))
|
||||
if (name == "error")
|
||||
parseError();
|
||||
else if (name == QLatin1String("announcethread"))
|
||||
else if (name == "announcethread")
|
||||
parseAnnounceThread();
|
||||
else if (name == QLatin1String("status"))
|
||||
else if (name == "status")
|
||||
parseStatus();
|
||||
else if (name == QLatin1String("errorcounts"))
|
||||
else if (name == "errorcounts")
|
||||
parseErrorCounts();
|
||||
else if (name == QLatin1String("suppcounts"))
|
||||
else if (name == "suppcounts")
|
||||
parseSuppressionCounts();
|
||||
else if (name == QLatin1String("protocolversion"))
|
||||
else if (name == "protocolversion")
|
||||
checkProtocolVersion(blockingReadElementText());
|
||||
else if (name == QLatin1String("protocoltool"))
|
||||
else if (name == "protocoltool")
|
||||
checkTool(blockingReadElementText());
|
||||
}
|
||||
} catch (const ParserException &e) {
|
||||
|
@@ -102,9 +102,9 @@ void SuppressionFrame::setObject(const QString &obj)
|
||||
QString SuppressionFrame::toString() const
|
||||
{
|
||||
if (!d->fun.isEmpty())
|
||||
return QLatin1String("fun:") + d->fun;
|
||||
return "fun:" + d->fun;
|
||||
else
|
||||
return QLatin1String("obj:") + d->obj;
|
||||
return "obj:" + d->obj;
|
||||
}
|
||||
|
||||
class Suppression::Private : public QSharedData
|
||||
@@ -222,7 +222,7 @@ QString Suppression::toString() const
|
||||
{
|
||||
QString ret;
|
||||
QTextStream stream(&ret);
|
||||
const QLatin1String indent(" ");
|
||||
const QString indent(" ");
|
||||
|
||||
stream << "{\n";
|
||||
stream << indent << d->name << '\n';
|
||||
|
Reference in New Issue
Block a user