forked from qt-creator/qt-creator
debugger: improve stepping performance in "instructionwise" mode.
Formatting of disassembler view took too much time.
This commit is contained in:
@@ -300,18 +300,20 @@ void DisassemblerViewAgentPrivate::configureMimeType()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(editor, return);
|
QTC_ASSERT(editor, return);
|
||||||
|
|
||||||
TextEditor::BaseTextDocument *doc = qobject_cast<TextEditor::BaseTextDocument *>(editor->file());
|
TextEditor::BaseTextDocument *doc =
|
||||||
|
qobject_cast<TextEditor::BaseTextDocument *>(editor->file());
|
||||||
QTC_ASSERT(doc, return);
|
QTC_ASSERT(doc, return);
|
||||||
doc->setMimeType(mimeType);
|
doc->setMimeType(mimeType);
|
||||||
|
|
||||||
TextEditor::PlainTextEditor *pe = qobject_cast<TextEditor::PlainTextEditor *>(editor->widget());
|
TextEditor::PlainTextEditor *pe =
|
||||||
|
qobject_cast<TextEditor::PlainTextEditor *>(editor->widget());
|
||||||
QTC_ASSERT(pe, return);
|
QTC_ASSERT(pe, return);
|
||||||
|
|
||||||
if (const MimeType mtype = ICore::instance()->mimeDatabase()->findByType(mimeType)) {
|
MimeType mtype = ICore::instance()->mimeDatabase()->findByType(mimeType);
|
||||||
|
if (mtype)
|
||||||
pe->configure(mtype);
|
pe->configure(mtype);
|
||||||
} else {
|
else
|
||||||
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
|
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DisassemblerViewAgent::mimeType() const
|
QString DisassemblerViewAgent::mimeType() const
|
||||||
|
|||||||
@@ -3881,7 +3881,8 @@ static QByteArray parseLine(const GdbMi &line)
|
|||||||
//QByteArray funcName = line.findChild("func-name").data();
|
//QByteArray funcName = line.findChild("func-name").data();
|
||||||
//QByteArray offset = line.findChild("offset").data();
|
//QByteArray offset = line.findChild("offset").data();
|
||||||
QByteArray inst = line.findChild("inst").data();
|
QByteArray inst = line.findChild("inst").data();
|
||||||
ba += address + QByteArray(15 - address.size(), ' ');
|
ba += address;
|
||||||
|
ba += QByteArray(15 - address.size(), ' ');
|
||||||
//ba += funcName + "+" + offset + " ";
|
//ba += funcName + "+" + offset + " ";
|
||||||
//ba += QByteArray(30 - funcName.size() - offset.size(), ' ');
|
//ba += QByteArray(30 - funcName.size() - offset.size(), ' ');
|
||||||
ba += inst;
|
ba += inst;
|
||||||
@@ -3910,7 +3911,7 @@ QString GdbEngine::parseDisassembler(const GdbMi &lines)
|
|||||||
// FIXME: Performance?
|
// FIXME: Performance?
|
||||||
foreach (const GdbMi &child, lines.children()) {
|
foreach (const GdbMi &child, lines.children()) {
|
||||||
if (child.hasName("src_and_asm_line")) {
|
if (child.hasName("src_and_asm_line")) {
|
||||||
// mixed mode
|
// Mixed mode.
|
||||||
if (!fileLoaded) {
|
if (!fileLoaded) {
|
||||||
QString fileName = QFile::decodeName(child.findChild("file").data());
|
QString fileName = QFile::decodeName(child.findChild("file").data());
|
||||||
fileName = cleanupFullName(fileName);
|
fileName = cleanupFullName(fileName);
|
||||||
@@ -3926,7 +3927,7 @@ QString GdbEngine::parseDisassembler(const GdbMi &lines)
|
|||||||
foreach (const GdbMi &line, insn.children())
|
foreach (const GdbMi &line, insn.children())
|
||||||
ba += parseLine(line);
|
ba += parseLine(line);
|
||||||
} else {
|
} else {
|
||||||
// the non-mixed version
|
// The non-mixed version.
|
||||||
ba += parseLine(child);
|
ba += parseLine(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4026,39 +4027,32 @@ void GdbEngine::handleFetchDisassemblerByCli(const GdbResponse &response)
|
|||||||
if (lines.isValid()) {
|
if (lines.isValid()) {
|
||||||
ac.agent->setContents(parseDisassembler(lines));
|
ac.agent->setContents(parseDisassembler(lines));
|
||||||
} else {
|
} else {
|
||||||
const QString someSpace = _(" ");
|
const QByteArray someSpace = " ";
|
||||||
// First line is something like
|
// First line is something like
|
||||||
// "Dump of assembler code from 0xb7ff598f to 0xb7ff5a07:"
|
// "Dump of assembler code from 0xb7ff598f to 0xb7ff5a07:"
|
||||||
GdbMi output = response.data.findChild("consolestreamoutput");
|
GdbMi output = response.data.findChild("consolestreamoutput");
|
||||||
QStringList res;
|
QByteArray res;
|
||||||
foreach (QByteArray line, output.data().split('\n')) {
|
foreach (const QByteArray &line0, output.data().split('\n')) {
|
||||||
line = line.trimmed();
|
QByteArray line = line0.trimmed();
|
||||||
if (line.startsWith("=> "))
|
if (line.startsWith("=> "))
|
||||||
line = line.mid(3);
|
line = line.mid(3);
|
||||||
if (line.startsWith("Current language:"))
|
if (line.startsWith("Current language:"))
|
||||||
continue;
|
continue;
|
||||||
if (line.startsWith("The current source"))
|
if (line.startsWith("The current source"))
|
||||||
continue;
|
continue;
|
||||||
|
if (line.startsWith("End of assembler"))
|
||||||
|
continue;
|
||||||
if (line.startsWith("0x")) {
|
if (line.startsWith("0x")) {
|
||||||
int pos1 = line.indexOf('<');
|
res.append(line);
|
||||||
int pos2 = line.indexOf('+', pos1);
|
res.append('\n');
|
||||||
int pos3 = line.indexOf('>', pos2);
|
|
||||||
if (pos3 >= 0) {
|
|
||||||
QByteArray ba = " <+" + line.mid(pos2 + 1, pos3 - pos2 - 1);
|
|
||||||
ba = line.left(pos1 - 1) + ba.rightJustified(4)
|
|
||||||
+ ">: " + line.mid(pos3 + 2);
|
|
||||||
res.append(_(ba));
|
|
||||||
} else {
|
|
||||||
res.append(_(line));
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
res.append(someSpace + _(line));
|
res.append(someSpace);
|
||||||
|
res.append(line);
|
||||||
|
res.append('\n');
|
||||||
}
|
}
|
||||||
// Drop "End of assembler dump." line.
|
|
||||||
res.takeLast();
|
|
||||||
if (res.size() > 1)
|
if (res.size() > 1)
|
||||||
ac.agent->setContents(res.join(_("\n")));
|
ac.agent->setContents(_(res));
|
||||||
else
|
else
|
||||||
fetchDisassemblerByAddressCli(ac);
|
fetchDisassemblerByAddressCli(ac);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user