Commit 8eaaef96 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/3.5'

Change-Id: I65968dd02ea6bdd15f304ae567dd0c02238e6949
parents 2f781ac2 0173c638
......@@ -17,4 +17,5 @@
<UserInterface>associatecommonfiletypesform.ui</UserInterface>
<UserInterface>launchqtcreatorcheckboxform.ui</UserInterface>
</UserInterfaces>
<StartMenuDir>Qt Creator {version}</StartMenuDir>
</Package>
......@@ -198,14 +198,14 @@
As the Perf tool only provides periodic samples, the CPU Usage Analyzer
cannot determine the exact time when a function was called or when it
returned. You can, however, see exactly when a sample was taken on the
returned. You can, however, see exactly when a sample was taken in the
second row of each thread. The CPU Usage Analyzer assumes that if the same
function is present in the same place in the call chain in multiple samples
on a row, then this represents a single call to the respective function.
This is, of course, a simplification. Also, there may be other functions
being called between the samples taken, which do not show up in the profile
data. However, statistically, the data is likely to show the functions that
spend the most CPU time most prominently.
function is present at the same place in the call chain in multiple
consecutive samples, then this represents a single call to the respective
function. This is, of course, a simplification. Also, there may be other
functions being called between the samples taken, which do not show up in
the profile data. However, statistically, the data is likely to show the
functions that spend the most CPU time most prominently.
If a function without debug information is encountered, further unwinding
of the stack may fail. Unwinding will also fail if a QML or JavaScript
......@@ -254,7 +254,7 @@
Start Board and SILICA Architect Tibidabo, are correctly set up for
profiling in the dwarf mode. For other devices, check whether Perf can read
back its own data in a sensible way by checking the output of
\c {perf report} or \c {perf script} in the recorded Perf data files.
\c {perf report} or \c {perf script} for the recorded Perf data files.
\section1 Troubleshooting
......
......@@ -569,7 +569,7 @@ class DumperBase:
elided, shown = self.computeLimit(size, limit)
return elided, self.readMemory(data, shown)
def putStdStringHelper(self, data, size, charSize, displayFormat = AutomaticFormat):
def putCharArrayHelper(self, data, size, charSize, displayFormat = AutomaticFormat):
bytelen = size * charSize
elided, shown = self.computeLimit(bytelen, self.displayStringLimit)
mem = self.readMemory(data, shown)
......@@ -587,7 +587,6 @@ class DumperBase:
encodingType = Hex8EncodedLittleEndian
displayType = DisplayUtf16String
self.putNumChild(0)
self.putValue(mem, encodingType, elided=elided)
if displayFormat == SeparateLatin1StringFormat \
......@@ -811,7 +810,7 @@ class DumperBase:
code = (None, "b", "H", None, "I")[tsize]
base = toInteger(p)
blob = self.extractBlob(base, maximum).toBytes()
for i in xrange(0, int(maximum / tsize)):
for i in xrange(0, maximum, tsize):
t = struct.unpack_from(code, blob, i)[0]
if t == 0:
return 0, i, self.hexencode(blob[:i])
......@@ -826,7 +825,7 @@ class DumperBase:
def putItemCount(self, count, maximum = 1000000000):
# This needs to override the default value, so don't use 'put' directly.
if count > maximum:
self.putSpeciaValue(SpecialMinimumItemCountValue, maximum)
self.putSpecialValue(SpecialMinimumItemCountValue, maximum)
else:
self.putSpecialValue(SpecialItemCountValue, count)
self.putNumChild(count)
......@@ -917,18 +916,10 @@ class DumperBase:
arrayByteSize = int(s[s.find('[')+1:s.find(']')]) * ts;
n = int(arrayByteSize / ts)
if displayFormat != RawFormat:
if innerTypeName == "char":
# Use Latin1 as default for char [].
blob = self.readMemory(self.addressOf(value), arrayByteSize)
self.putValue(blob, Hex2EncodedLatin1)
elif innerTypeName == "wchar_t":
blob = self.readMemory(self.addressOf(value), arrayByteSize)
if innerType.sizeof == 2:
self.putValue(blob, Hex4EncodedLittleEndian)
else:
self.putValue(blob, Hex8EncodedLittleEndian)
elif p:
if displayFormat != RawFormat and p:
if innerTypeName == "char" or innerTypeName == "wchar_t":
self.putCharArrayHelper(p, n, ts, self.currentItemFormat())
else:
self.tryPutSimpleFormattedPointer(p, arrayType, innerTypeName,
displayFormat, arrayByteSize)
self.putNumChild(n)
......@@ -1661,7 +1652,6 @@ class DumperBase:
with TopLevelItem(self, iname):
self.put('iname="%s",' % iname)
self.put('name="%s",' % exp)
self.put('wname="%s",' % escapedExp)
try:
value = self.parseAndEvaluate(exp)
......
......@@ -155,7 +155,7 @@ class PlainDumper:
if isinstance(val, str):
d.putValue(val)
else: # Assuming LazyString
d.putStdStringHelper(val.address, val.length, val.type.sizeof)
d.putCharArrayHelper(val.address, val.length, val.type.sizeof)
d.putNumChild(len(children))
if d.isExpanded():
......@@ -811,6 +811,14 @@ class Dumper(DumperBase):
return None
def qtVersion(self):
try:
# Only available with Qt 5.3+
qtversion = int(gdb.parse_and_eval("((void**)&qtHookData)[2]"))
self.qtVersion = lambda: qtversion
return qtversion
except:
pass
try:
version = self.qtVersionString()
(major, minor, patch) = version[version.find('"')+1:version.rfind('"')].split('.')
......
......@@ -1592,18 +1592,27 @@ class Dumper(DumperBase):
self.reportToken(args)
addr = args.get('address', 0)
if addr:
error = self.currentThread().RunToAddress(addr)
# Does not seem to hit anything on Linux:
# self.currentThread().RunToAddress(addr)
bp = self.target.BreakpointCreateByAddress(addr)
if bp.GetNumLocations() == 0:
self.target.BreakpointDelete(bp.GetID())
self.reportStatus("No target location found.")
self.reportLocation(frame)
return
bp.SetOneShot(True)
self.process.Continue()
else:
frame = self.currentFrame()
file = args['file']
line = int(args['line'])
error = self.currentThread().StepOverUntil(frame, lldb.SBFileSpec(file), line)
if error.GetType():
self.reportState("running")
self.reportState("stopped")
self.reportError(error)
else:
self.reportData()
if error.GetType():
self.reportState("running")
self.reportState("stopped")
self.reportError(error)
else:
self.reportData()
def executeJumpToLocation(self, args):
self.reportToken(args)
......
......@@ -58,7 +58,7 @@ def qform__QByteArray():
def qdump__QByteArray(d, value):
data, size, alloc = d.byteArrayData(value)
d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 100)
d.check(alloc == 0 or (0 <= size and size <= alloc and alloc <= 100000000))
d.putNumChild(size)
elided, p = d.encodeByteArrayHelper(d.extractPointer(value), d.displayStringLimit)
displayFormat = d.currentItemFormat()
......@@ -79,7 +79,7 @@ def qdump__QByteArray(d, value):
def qdump__QByteArrayData(d, value):
data, size, alloc = d.byteArrayDataHelper(d.addressOf(value))
d.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 100)
d.check(alloc == 0 or (0 <= size and size <= alloc and alloc <= 100000000))
d.putValue(d.readMemory(data, size), Hex2EncodedLatin1)
d.putNumChild(1)
if d.isExpanded():
......@@ -280,7 +280,7 @@ def qdump__QDateTime(d, value):
tz = ""
else:
idBase = tzp + 2 * d.ptrSize() # [QSharedData] + [vptr]
tz = d.encodeByteArrayHelper(d.extractPointer(idBase), limit=100)
elided, tz = d.encodeByteArrayHelper(d.extractPointer(idBase), limit=100)
d.putValue("%s/%s/%s/%s/%s" % (msecs, spec, offset, tz, status),
DateTimeInternal)
else:
......@@ -2609,11 +2609,11 @@ def qdumpHelper__QJsonArray(d, data, array):
array is passed as integer pointer to the QJsonPrivate::Base object.
"""
if d.isNull(data):
n = 0
else:
if data:
# The 'length' part of the _dummy member:
n = qdumpHelper_qle_cutBits(d.extractUInt(array + 4), 1, 31)
else:
n = 0
d.putItemCount(n)
d.putNumChild(1)
......@@ -2634,11 +2634,11 @@ def qdumpHelper__QJsonObject(d, data, obj):
obj is passed as integer pointer to the QJsonPrivate::Base object.
"""
if d.isNull(data):
n = 0
else:
if data:
# The 'length' part of the _dummy member:
n = qdumpHelper_qle_cutBits(d.extractUInt(obj + 4), 1, 31)
else:
n = 0
d.putItemCount(n)
d.putNumChild(1)
......
......@@ -419,7 +419,7 @@ def qdump__std__stringHelper1(d, value, charSize, format):
refcount = int(sizePtr[-1]) & 0xffffffff
d.check(refcount >= -1) # Can be -1 accoring to docs.
d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)
d.putStdStringHelper(sizePtr, size, charSize, format)
d.putCharArrayHelper(sizePtr, size, charSize, format)
def qdump__std__stringHelper1__QNX(d, value, charSize, format):
size = value['_Mysize']
......@@ -433,7 +433,7 @@ def qdump__std__stringHelper1__QNX(d, value, charSize, format):
refcount = int(sizePtr[-1])
d.check(refcount >= -1) # Can be -1 accoring to docs.
d.check(0 <= size and size <= alloc and alloc <= 100*1000*1000)
d.putStdStringHelper(sizePtr, size, charSize, format)
d.putCharArrayHelper(sizePtr, size, charSize, format)
def qdump__std____1__string(d, value):
......@@ -447,7 +447,7 @@ def qdump__std____1__string(d, value):
# Short/internal.
size = firstByte / 2
data = base + 1
d.putStdStringHelper(data, size, 1, d.currentItemFormat())
d.putCharArrayHelper(data, size, 1, d.currentItemFormat())
d.putType("std::string")
......@@ -462,7 +462,7 @@ def qdump__std____1__wstring(d, value):
# Short/internal.
size = firstByte / 2
data = base + 4
d.putStdStringHelper(data, size, 4)
d.putCharArrayHelper(data, size, 4)
d.putType("std::xxwstring")
......
......@@ -292,10 +292,13 @@ static inline QSettings *userSettings()
int main(int argc, char **argv)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
if (Utils::HostOsInfo().isWindowsHost()
&& !qEnvironmentVariableIsSet("QT_DEVICE_PIXEL_RATIO")) {
qputenv("QT_DEVICE_PIXEL_RATIO", "auto");
}
#endif // < Qt 5.6
QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false"));
#ifdef Q_OS_MAC
// increase the number of file that can be opened in Qt Creator.
......
......@@ -191,7 +191,7 @@ void QmlDebugConnectionPrivate::readyRead()
emit q->opened();
}
while (protocol->packetsAvailable()) {
while (protocol && protocol->packetsAvailable()) {
QPacket pack = protocol->read();
QString name;
pack >> name;
......
......@@ -1104,6 +1104,7 @@ AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int ty
}
if (!size)
return AbstractSymbolGroupNodePtrVector();
node->addFlags(SymbolGroupNode::PreSortedChildren);
const unsigned maxArraySize = ExtensionContext::instance().parameters().maxArraySize;
if (size > maxArraySize)
size = maxArraySize;
......
......@@ -168,7 +168,7 @@ bool AbstractSymbolGroupNode::accept(SymbolGroupNodeVisitor &visitor,
break;
case SymbolGroupNodeVisitor::VisitContinue: {
AbstractSymbolGroupNodePtrVector c = children();
if (visitor.sortChildrenAlphabetically()) {
if (visitor.sortChildrenAlphabetically() && !testFlags(SymbolGroupNode::PreSortedChildren)) {
std::sort(c.begin(), c.end(), [](AbstractSymbolGroupNode *a, AbstractSymbolGroupNode *b) {
return a->name() < b->name();
});
......
......@@ -230,7 +230,8 @@ public:
AdditionalSymbol = 0x20, // Introduced by addSymbol, should not be visible
Obscured = 0x40, // Symbol is obscured by (for example) fake container children
ComplexDumperOk = 0x80,
WatchNode = 0x100
WatchNode = 0x100,
PreSortedChildren = 0x200
};
~SymbolGroupNode();
......
......@@ -38,6 +38,8 @@
#include <QDebug>
#ifdef Q_OS_LINUX
#include <cerrno>
#include <cstring>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <sys/types.h>
......
......@@ -112,9 +112,12 @@ void SshOutgoingPacket::generateServiceRequest(const QByteArray &service)
void SshOutgoingPacket::generateUserAuthByPasswordRequestPacket(const QByteArray &user,
const QByteArray &service, const QByteArray &pwd)
{
init(SSH_MSG_USERAUTH_REQUEST).appendString(user).appendString(service)
.appendString("password").appendBool(false).appendString(pwd)
.finalize();
init(SSH_MSG_USERAUTH_REQUEST).appendString(user).appendString(service);
if (pwd.isEmpty())
appendString("none"); // RFC 4252, 5.2
else
appendString("password").appendBool(false).appendString(pwd);
finalize();
}
void SshOutgoingPacket::generateUserAuthByPublicKeyRequestPacket(const QByteArray &user,
......
......@@ -146,7 +146,7 @@ RunControl *BareMetalRunControlFactory::create(
if (p->startupMode() == GdbServerProvider::StartupOnNetwork)
sp.remoteSetupNeeded = true;
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage);
DebuggerRunControl *runControl = createDebuggerRunControl(sp, rc, errorMessage, mode);
if (runControl && sp.remoteSetupNeeded) {
const auto debugSupport = new BareMetalDebugSupport(dev, runControl);
Q_UNUSED(debugSupport);
......
......@@ -59,6 +59,29 @@ DefaultGdbServerProvider::DefaultGdbServerProvider(const DefaultGdbServerProvide
{
}
quint16 DefaultGdbServerProvider::port() const
{
return m_port;
}
void DefaultGdbServerProvider::setPort(const quint16 &port)
{
m_port = port;
}
QString DefaultGdbServerProvider::host() const
{
return m_host;
}
void DefaultGdbServerProvider::setHost(const QString &host)
{
if (m_host == host)
return;
m_host = host;
providerUpdated();
}
QString DefaultGdbServerProvider::typeDisplayName() const
{
return DefaultGdbServerProviderFactory::tr("Default");
......@@ -183,8 +206,8 @@ void DefaultGdbServerProviderConfigWidget::applyImpl()
auto p = static_cast<DefaultGdbServerProvider *>(provider());
Q_ASSERT(p);
p->m_host = m_hostWidget->host();
p->m_port = m_hostWidget->port();
p->setHost(m_hostWidget->host());
p->setPort(m_hostWidget->port());
p->setInitCommands(m_initCommandsTextEdit->toPlainText());
p->setResetCommands(m_resetCommandsTextEdit->toPlainText());
}
......
......@@ -56,6 +56,12 @@ public:
bool isValid() const;
QString host() const;
void setHost(const QString &host);
quint16 port() const;
void setPort(const quint16 &port);
private:
explicit DefaultGdbServerProvider();
explicit DefaultGdbServerProvider(const DefaultGdbServerProvider &);
......
......@@ -100,10 +100,7 @@ QList<AssistProposalItem *> toAssistProposalItems(const CodeCompletions &complet
items.insert(name, item);
item->setText(name);
item->setOrder(ccr.priority());
if (ccr.completionKind() == CodeCompletion::KeywordCompletionKind)
item->setDetail(CompletionChunksToTextConverter::convertToToolTip(ccr.chunks()));
item->setDetail(CompletionChunksToTextConverter::convertToToolTip(ccr.chunks()));
item->setCodeCompletion(ccr);
}
......
......@@ -44,7 +44,7 @@
#include <QDir>
#include <QFile>
#include <QLoggingCategory>
#include <QRegExp>
#include <QRegularExpression>
#include <QSet>
#include <QString>
......@@ -154,8 +154,9 @@ private:
// We already provide a custom clang include path matching the used libclang version,
// so better ignore the clang include paths from the system as this might lead to an
// unfavorable order with regard to include_next.
static QRegExp clangIncludeDir(QLatin1String(".*/lib/clang/\\d+\\.\\d+\\.\\d+/include"));
if (clangIncludeDir.exactMatch(path))
static QRegularExpression clangIncludeDir(
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
if (clangIncludeDir.match(path).hasMatch())
return true;
return false;
......
......@@ -623,15 +623,33 @@ public:
ProposalModel proposal;
};
bool hasItem(ProposalModel model, const QByteArray &text)
int indexOfItemWithText(ProposalModel model, const QByteArray &text)
{
if (!model)
return false;
return -1;
for (int i = 0, size = model->size(); i < size; ++i) {
const QString itemText = model->text(i);
if (itemText == QString::fromUtf8(text))
return true;
return i;
}
return -1;
}
bool hasItem(ProposalModel model, const QByteArray &text)
{
return indexOfItemWithText(model, text) != -1;
}
bool hasItem(ProposalModel model, const QByteArray &text, const QByteArray &detail)
{
const int index = indexOfItemWithText(model, text);
if (index != -1 && index < model->size()) {
TextEditor::IAssistProposalModel *imodel = model.data();
const auto genericModel = static_cast<TextEditor::GenericProposalModel *>(imodel);
const auto itemDetail = genericModel->detail(index);
return itemDetail == QString::fromUtf8(detail);
}
return false;
......@@ -844,10 +862,10 @@ void ClangCodeCompletionTest::testCompleteGlobals()
{
ProjectLessCompletionTest t("globalCompletion.cpp");
QVERIFY(hasItem(t.proposal, "globalVariable"));
QVERIFY(hasItem(t.proposal, "globalFunction"));
QVERIFY(hasItem(t.proposal, "GlobalClass"));
QVERIFY(hasItem(t.proposal, "class")); // Keyword
QVERIFY(hasItem(t.proposal, "globalVariable", "int globalVariable"));
QVERIFY(hasItem(t.proposal, "globalFunction", "void globalFunction ()"));
QVERIFY(hasItem(t.proposal, "GlobalClass", "GlobalClass"));
QVERIFY(hasItem(t.proposal, "class", "class")); // Keyword
QVERIFY(hasSnippet(t.proposal, "class")); // Snippet
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment