diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index ab2172fba794abca6ab47d6194d224622f2dcb11..fe1396f7b1e9bcf2e2c1dc5ddbd5233d71d37d3c 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -1346,8 +1346,9 @@ void CdbEngine::fetchDisassembler(DisassemblerViewAgent *agent) if (debugCDB) qDebug() << "fetchDisassembler" << address << " Agent: " << agent->address(); + DisassemblerLines lines; if (address == 0) { // Clear window - agent->setContents(QString()); + agent->setContents(lines); return; } QString disassembly; @@ -1355,11 +1356,12 @@ void CdbEngine::fetchDisassembler(DisassemblerViewAgent *agent) const bool ok = disassemble(m_d, address, ContextLines, ContextLines, QTextStream(&disassembly), &errorMessage); QApplication::restoreOverrideCursor(); if (ok) { - agent->setContents(disassembly); + foreach(const QString &line, disassembly.remove(QLatin1Char('\r')).split(QLatin1Char('\n'))) + lines.appendLine(DisassemblerLine(line)); } else { - agent->setContents(QString()); warning(errorMessage); } + agent->setContents(lines); } void CdbEngine::fetchMemory(MemoryViewAgent *agent, QObject *token, quint64 addr, quint64 length) diff --git a/src/plugins/debugger/cdb2/cdbengine2.cpp b/src/plugins/debugger/cdb2/cdbengine2.cpp index 5452548d056b893ddad9cf27c5ea1ae85cc6e56a..17df4e0027513c33e8ba4daf3b171e557fa60397 100644 --- a/src/plugins/debugger/cdb2/cdbengine2.cpp +++ b/src/plugins/debugger/cdb2/cdbengine2.cpp @@ -1021,7 +1021,10 @@ void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command) { QTC_ASSERT(qVariantCanConvert<Debugger::Internal::DisassemblerViewAgent*>(command->cookie), return;) Debugger::Internal::DisassemblerViewAgent *agent = qvariant_cast<Debugger::Internal::DisassemblerViewAgent*>(command->cookie); - agent->setContents(formatCdbDisassembler(command->reply)); + DisassemblerLines disassemblerLines; + foreach(const QByteArray &line, command->reply) + disassemblerLines.appendLine(DisassemblerLine(QString::fromLatin1(line))); + agent->setContents(disassemblerLines); } void CdbEngine::fetchMemory(Debugger::Internal::MemoryViewAgent *agent, QObject *editor, quint64 addr, quint64 length) diff --git a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp index 1a1ad80d621a497c5c8bd208f394a4bbe1365d62..b69b8994ab144be7fe6fe765acf7114209f2b19f 100644 --- a/src/plugins/debugger/cdb2/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb2/cdbparsehelpers.cpp @@ -33,7 +33,6 @@ #include "threadshandler.h" #include "registerhandler.h" #include "bytearrayinputstream.h" -#include "debuggeragents.h" #include "gdb/gdbmi.h" #ifdef Q_OS_WIN # include "shared/dbgwinutils.h" @@ -98,21 +97,6 @@ QByteArray cdbAddBreakpointCommand(const Debugger::Internal::BreakpointParameter return rc; } -// Remove the address separator. Format the address exactly as -// the agent does (0xhex, as taken from frame) for the location mark to trigger. -Internal::DisassemblerLines formatCdbDisassembler(const QList<QByteArray> &in) -{ - Internal::DisassemblerLines result; - foreach(QByteArray line, in) { - // Remove 64bit separator. - if (line.size() >= 9 && line.at(8) == '`') - line.remove(8, 1); - // Ensure address is as wide as agent's address. - result.appendLine(Internal::DisassemblerLine(line)); - } - return result; -} - // Fix a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10' QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros, int *basePtr /* = 0 */) { diff --git a/src/plugins/debugger/cdb2/cdbparsehelpers.h b/src/plugins/debugger/cdb2/cdbparsehelpers.h index 5ada8612e7b23b5425c15b5dc6a2fd69944a276c..4d85df14f711e76a3886dfe23129db72174f697d 100644 --- a/src/plugins/debugger/cdb2/cdbparsehelpers.h +++ b/src/plugins/debugger/cdb2/cdbparsehelpers.h @@ -44,7 +44,6 @@ namespace Debugger { namespace Internal { class BreakpointData; class BreakpointParameters; -class DisassemblerLines; class StackFrame; struct ThreadData; class Register; @@ -56,9 +55,6 @@ namespace Cdb { // Convert breakpoint in CDB syntax. QByteArray cdbAddBreakpointCommand(const Debugger::Internal::BreakpointParameters &d, bool oneshot = false, int id = -1); -// Format CDB Dissambler output. -Internal::DisassemblerLines formatCdbDisassembler(const QList<QByteArray> &in); - // Convert a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10' QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros = false, int *basePtr = 0); // Convert a CDB integer value into quint64 or int64 diff --git a/src/plugins/debugger/debuggeragents.cpp b/src/plugins/debugger/debuggeragents.cpp index aa4247b443ec2fc1f1c4161744c7e73be00f0351..bff396217dfba5dc1950af517183b5153a33d564 100644 --- a/src/plugins/debugger/debuggeragents.cpp +++ b/src/plugins/debugger/debuggeragents.cpp @@ -416,6 +416,10 @@ DisassemblerLine::DisassemblerLine(const QString &unparsed) return; } QString addr = unparsed.left(pos); + // MSVC 64bit: Remove 64bit separator 00000000`00a45000'. + if (addr.size() >= 9 && addr.at(8) == QLatin1Char('`')) + addr.remove(8, 1); + if (addr.endsWith(':')) // clang addr.chop(1); if (addr.startsWith(QLatin1String("0x"))) diff --git a/src/plugins/debugger/debuggeragents.h b/src/plugins/debugger/debuggeragents.h index 7cbcdae0ba99ef29dc0d4f1aa68815619fa9f7a5..57d3c02c4b549f8298f3330484fd53912bf787a9 100644 --- a/src/plugins/debugger/debuggeragents.h +++ b/src/plugins/debugger/debuggeragents.h @@ -90,6 +90,7 @@ class DisassemblerLines { public: DisassemblerLines() {} + bool coversAddress(quint64 address) const; void appendLine(const DisassemblerLine &dl); void appendComment(const QString &comment);