Merge remote-tracking branch 'origin/4.4'

Change-Id: I7bf72444b19db20fcc7dc2c9d1f02ec2b30b658f
This commit is contained in:
Eike Ziller
2017-09-25 11:00:25 +02:00
9 changed files with 47 additions and 36 deletions

View File

@@ -1258,9 +1258,7 @@ class Dumper(DumperBase):
if not skipEventReporting: if not skipEventReporting:
self.eventState = state self.eventState = state
if state == lldb.eStateExited: if state == lldb.eStateExited:
if self.isShuttingDown_: if not self.isShuttingDown_:
self.reportState("inferiorshutdownok")
else:
self.reportState("inferiorexited") self.reportState("inferiorexited")
self.report('exited={status="%s",desc="%s"}' self.report('exited={status="%s",desc="%s"}'
% (self.process.GetExitStatus(), self.process.GetExitDescription())) % (self.process.GetExitStatus(), self.process.GetExitDescription()))
@@ -1290,7 +1288,7 @@ class Dumper(DumperBase):
return return
if self.isInterrupting_: if self.isInterrupting_:
self.isInterrupting_ = False self.isInterrupting_ = False
self.reportState("stopped") self.reportState("inferiorstopok")
elif self.ignoreStops > 0: elif self.ignoreStops > 0:
self.ignoreStops -= 1 self.ignoreStops -= 1
self.process.Continue() self.process.Continue()

View File

@@ -211,7 +211,7 @@ void Lexer::scan_helper(Token *tok)
_state = 0; _state = 0;
scanCppComment(originalKind); scanCppComment(originalKind);
return; return;
} else if (isRawStringLiteral(s._tokenKind)) { } else if (!control() && isRawStringLiteral(s._tokenKind)) {
tok->f.kind = s._tokenKind; tok->f.kind = s._tokenKind;
if (scanUntilRawStringLiteralEndSimple()) if (scanUntilRawStringLiteralEndSimple())
_state = 0; _state = 0;
@@ -755,13 +755,17 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
yyinp(); yyinp();
} else if (_yychar == ')') { } else if (_yychar == ')') {
yyinp(); yyinp();
if (delimLength == -1) if (delimLength == -1) {
break; tok->f.kind = T_ERROR;
return;
}
closingDelimCandidate = _currentChar; closingDelimCandidate = _currentChar;
} else { } else {
if (delimLength == -1) { if (delimLength == -1) {
if (_yychar == '\\' || std::isspace(_yychar)) if (_yychar == '\\' || std::isspace(_yychar)) {
break; tok->f.kind = T_ERROR;
return;
}
yyinp(); yyinp();
} else { } else {
if (!closingDelimCandidate) { if (!closingDelimCandidate) {
@@ -804,7 +808,7 @@ void Lexer::scanRawStringLiteral(Token *tok, unsigned char hint)
else else
tok->f.kind = T_RAW_STRING_LITERAL; tok->f.kind = T_RAW_STRING_LITERAL;
if (!closed) if (!control() && !closed)
s._tokenKind = tok->f.kind; s._tokenKind = tok->f.kind;
} }

View File

@@ -210,8 +210,6 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
this, &SearchResultWidget::handleReplaceButton); this, &SearchResultWidget::handleReplaceButton);
connect(m_replaceButton, &QAbstractButton::clicked, connect(m_replaceButton, &QAbstractButton::clicked,
this, &SearchResultWidget::handleReplaceButton); this, &SearchResultWidget::handleReplaceButton);
connect(m_replaceTextEdit, &QLineEdit::textChanged,
this, &SearchResultWidget::handleReplaceEditTextChanged);
} }
SearchResultWidget::~SearchResultWidget() SearchResultWidget::~SearchResultWidget()
@@ -306,7 +304,6 @@ void SearchResultWidget::setSupportsReplace(bool replaceSupported, const QString
void SearchResultWidget::setTextToReplace(const QString &textToReplace) void SearchResultWidget::setTextToReplace(const QString &textToReplace)
{ {
m_replaceText = textToReplace;
m_replaceTextEdit->setText(textToReplace); m_replaceTextEdit->setText(textToReplace);
} }
@@ -409,6 +406,7 @@ void SearchResultWidget::goToPrevious()
void SearchResultWidget::restart() void SearchResultWidget::restart()
{ {
m_replaceTextEdit->setEnabled(false); m_replaceTextEdit->setEnabled(false);
m_replaceButton->setEnabled(false);
m_searchResultTreeView->clear(); m_searchResultTreeView->clear();
m_count = 0; m_count = 0;
Id sizeWarningId(SIZE_WARNING_ID); Id sizeWarningId(SIZE_WARNING_ID);
@@ -418,7 +416,6 @@ void SearchResultWidget::restart()
m_searchAgainButton->setVisible(false); m_searchAgainButton->setVisible(false);
m_messageWidget->setVisible(false); m_messageWidget->setVisible(false);
updateMatchesFoundLabel(); updateMatchesFoundLabel();
handleReplaceEditTextChanged();
emit restarted(); emit restarted();
} }
@@ -439,6 +436,7 @@ void SearchResultWidget::finishSearch(bool canceled)
m_infoBar.removeInfo(sizeWarningId); m_infoBar.removeInfo(sizeWarningId);
m_infoBar.enableInfo(sizeWarningId); m_infoBar.enableInfo(sizeWarningId);
m_replaceTextEdit->setEnabled(m_count > 0); m_replaceTextEdit->setEnabled(m_count > 0);
m_replaceButton->setEnabled(m_count > 0);
m_preserveCaseCheck->setEnabled(m_count > 0); m_preserveCaseCheck->setEnabled(m_count > 0);
m_cancelButton->setVisible(false); m_cancelButton->setVisible(false);
m_messageWidget->setVisible(canceled); m_messageWidget->setVisible(canceled);
@@ -463,15 +461,6 @@ void SearchResultWidget::cancelAfterSizeWarning()
emit paused(false); emit paused(false);
} }
void SearchResultWidget::handleReplaceEditTextChanged()
{
const bool enabled = m_replaceTextEdit->text() != m_replaceText;
m_replaceButton->setEnabled(enabled);
m_replaceButton->setToolTip(enabled
? QString()
: tr("Cannot replace because replacement text is unchanged."));
}
void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item) void SearchResultWidget::handleJumpToSearchResult(const SearchResultItem &item)
{ {
emit activated(item); emit activated(item);

View File

@@ -115,7 +115,6 @@ private:
void setShowReplaceUI(bool visible); void setShowReplaceUI(bool visible);
void continueAfterSizeWarning(); void continueAfterSizeWarning();
void cancelAfterSizeWarning(); void cancelAfterSizeWarning();
void handleReplaceEditTextChanged();
QList<SearchResultItem> checkedItems() const; QList<SearchResultItem> checkedItems() const;
void updateMatchesFoundLabel(); void updateMatchesFoundLabel();
@@ -142,7 +141,6 @@ private:
bool m_isShowingReplaceUI = false; bool m_isShowingReplaceUI = false;
bool m_searchAgainSupported = false; bool m_searchAgainSupported = false;
bool m_replaceSupported = false; bool m_replaceSupported = false;
QString m_replaceText;
}; };
} // Internal } // Internal

View File

@@ -891,6 +891,8 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState)
} }
} else if (newState == "inferiorstopok") { } else if (newState == "inferiorstopok") {
notifyInferiorStopOk(); notifyInferiorStopOk();
if (!isDying())
updateAll();
} else if (newState == "inferiorstopfailed") } else if (newState == "inferiorstopfailed")
notifyInferiorStopFailed(); notifyInferiorStopFailed();
else if (newState == "inferiorill") else if (newState == "inferiorill")

View File

@@ -4324,7 +4324,6 @@ void TextEditorWidget::paintEvent(QPaintEvent *e)
for (int i = line.lineNumber() + 1; i < eline.lineNumber(); ++i) { for (int i = line.lineNumber() + 1; i < eline.lineNumber(); ++i) {
rr = layout->lineAt(i).naturalTextRect(); rr = layout->lineAt(i).naturalTextRect();
rr.moveTop(rr.top() + r.top()); rr.moveTop(rr.top() + r.top());
rr.setLeft(r.left() + x);
painter.fillRect(rr, palette().highlight()); painter.fillRect(rr, palette().highlight());
} }

View File

@@ -366,6 +366,14 @@ void tst_SimpleLexer::literals_data()
<< T_RAW_STRING_LITERAL << T_RAW_STRING_LITERAL
; ;
QTest::newRow("raw-string-literals") << source << expectedTokenKindList; QTest::newRow("raw-string-literals") << source << expectedTokenKindList;
source = "R\"\\" ;
expectedTokenKindList = TokenKindList() << T_ERROR;
QTest::newRow("invalid-raw-string-literals1") << source << expectedTokenKindList;
source = "R\")" ;
expectedTokenKindList = TokenKindList() << T_ERROR;
QTest::newRow("invalid-raw-string-literals2") << source << expectedTokenKindList;
} }
void tst_SimpleLexer::preprocessor() void tst_SimpleLexer::preprocessor()

View File

@@ -48,6 +48,8 @@ private slots:
void astPathOnGeneratedTokens(); void astPathOnGeneratedTokens();
void typeMatcher(); void typeMatcher();
void doNotCrashForInvalidRawString();
}; };
void tst_Misc::diagnosticClient_error() void tst_Misc::diagnosticClient_error()
@@ -266,5 +268,16 @@ void tst_Misc::typeMatcher()
} }
} }
void tst_Misc::doNotCrashForInvalidRawString()
{
const QByteArray src("\n"
"void f() { enum { Size = sizeof(R\"[^\\s]+([^]+)*\") }; }"
"}\n"
);
Document::Ptr doc = Document::create("crash");
doc->setUtf8Source(src);
doc->check();
}
QTEST_MAIN(tst_Misc) QTEST_MAIN(tst_Misc)
#include "tst_misc.moc" #include "tst_misc.moc"

View File

@@ -1049,7 +1049,7 @@ void tst_Dumpers::initTestCase()
ok = debugger.waitForFinished(); ok = debugger.waitForFinished();
QVERIFY(ok); QVERIFY(ok);
QByteArray output = debugger.readAllStandardOutput(); QByteArray output = debugger.readAllStandardOutput();
//qDebug() << "stdout: " << output; //qDebug().noquote() << "stdout: " << output;
bool usePython = !output.contains("Python scripting is not supported in this copy of GDB"); bool usePython = !output.contains("Python scripting is not supported in this copy of GDB");
qDebug() << "Python : " << (usePython ? "ok" : "*** not ok ***"); qDebug() << "Python : " << (usePython ? "ok" : "*** not ok ***");
qDebug() << "Dumper dir : " << DUMPERDIR; qDebug() << "Dumper dir : " << DUMPERDIR;
@@ -1418,11 +1418,11 @@ void tst_Dumpers::dumper()
error = make.readAllStandardError(); error = make.readAllStandardError();
//qDebug() << "stdout: " << output; //qDebug() << "stdout: " << output;
if (make.exitCode()) { if (make.exitCode()) {
qDebug() << error; qDebug().noquote() << error;
qDebug() << "\n------------------ CODE --------------------"; qDebug() << "\n------------------ CODE --------------------";
qDebug() << fullCode; qDebug().noquote() << fullCode;
qDebug() << "\n------------------ CODE --------------------"; qDebug() << "\n------------------ CODE --------------------";
qDebug() << "Project file: " << proFile.fileName(); qDebug().noquote() << "Project file: " << proFile.fileName();
} }
if (data.neededDwarfVersion.isRestricted) { if (data.neededDwarfVersion.isRestricted) {
@@ -1588,7 +1588,7 @@ void tst_Dumpers::dumper()
if (m_debuggerEngine == GdbEngine) { if (m_debuggerEngine == GdbEngine) {
int posDataStart = output.indexOf("data="); int posDataStart = output.indexOf("data=");
if (posDataStart == -1) { if (posDataStart == -1) {
qDebug() << "NO \"data=\" IN OUTPUT: " << output; qDebug().noquote() << "NO \"data=\" IN OUTPUT: " << output;
QVERIFY(posDataStart != -1); QVERIFY(posDataStart != -1);
} }
contents = output.mid(posDataStart); contents = output.mid(posDataStart);
@@ -1600,7 +1600,7 @@ void tst_Dumpers::dumper()
//qDebug() << "FOUND NS: " << context.nameSpace; //qDebug() << "FOUND NS: " << context.nameSpace;
} else if (m_debuggerEngine == LldbEngine) { } else if (m_debuggerEngine == LldbEngine) {
//qDebug() << "GOT OUTPUT: " << output; //qDebug().noquote() << "GOT OUTPUT: " << output;
int pos = output.indexOf("data=[{"); int pos = output.indexOf("data=[{");
QVERIFY(pos != -1); QVERIFY(pos != -1);
output = output.mid(pos); output = output.mid(pos);
@@ -1608,7 +1608,7 @@ void tst_Dumpers::dumper()
int posNameSpaceStart = output.indexOf("@NS@"); int posNameSpaceStart = output.indexOf("@NS@");
if (posNameSpaceStart == -1) if (posNameSpaceStart == -1)
qDebug() << "OUTPUT: " << output; qDebug().noquote() << "OUTPUT: " << output;
QVERIFY(posNameSpaceStart != -1); QVERIFY(posNameSpaceStart != -1);
posNameSpaceStart += sizeof("@NS@") - 1; posNameSpaceStart += sizeof("@NS@") - 1;
int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart); int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart);
@@ -1624,7 +1624,7 @@ void tst_Dumpers::dumper()
QByteArray locals("|script|"); QByteArray locals("|script|");
int localsBeginPos = output.indexOf(locals, output.indexOf(localsAnswerStart)); int localsBeginPos = output.indexOf(locals, output.indexOf(localsAnswerStart));
if (localsBeginPos == -1) if (localsBeginPos == -1)
qDebug() << "OUTPUT: " << output; qDebug().noquote() << "OUTPUT: " << output;
QVERIFY(localsBeginPos != -1); QVERIFY(localsBeginPos != -1);
do { do {
const int msgStart = localsBeginPos + locals.length(); const int msgStart = localsBeginPos + locals.length();
@@ -1755,8 +1755,8 @@ void tst_Dumpers::dumper()
break; break;
qDebug() << "MSG: " << fullOutput.mid(pos1, pos2 - pos1 - 1); qDebug() << "MSG: " << fullOutput.mid(pos1, pos2 - pos1 - 1);
} }
qDebug() << "CONTENTS : " << contents; qDebug().noquote() << "CONTENTS : " << contents;
qDebug() << "FULL OUTPUT : " << fullOutput.data(); qDebug().noquote() << "FULL OUTPUT : " << fullOutput.data();
qDebug() << "Qt VERSION : " << QString::number(context.qtVersion, 16); qDebug() << "Qt VERSION : " << QString::number(context.qtVersion, 16);
if (m_debuggerEngine != CdbEngine) if (m_debuggerEngine != CdbEngine)
qDebug() << "GCC VERSION : " << context.gccVersion; qDebug() << "GCC VERSION : " << context.gccVersion;