forked from qt-creator/qt-creator
debugger: fix chain of fallbacks for disassembler view.
Use non-mixed mode if source is not available.
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QSyntaxHighlighter>
|
||||
@@ -182,7 +183,7 @@ private:
|
||||
*/
|
||||
|
||||
DisassemblerViewAgent::DisassemblerViewAgent(DebuggerManager *manager)
|
||||
: QObject(manager), d(new DisassemblerViewAgentPrivate)
|
||||
: QObject(0), d(new DisassemblerViewAgentPrivate), m_manager(manager)
|
||||
{
|
||||
d->editor = 0;
|
||||
d->locationMark = new LocationMark2();
|
||||
@@ -212,13 +213,21 @@ void DisassemblerViewAgent::resetLocation()
|
||||
d->editor->markableInterface()->removeMark(d->locationMark);
|
||||
}
|
||||
|
||||
QString frameKey(const StackFrame &frame)
|
||||
{
|
||||
return _("%1:%2:%3").arg(frame.function).arg(frame.file).arg(frame.from);
|
||||
}
|
||||
|
||||
void DisassemblerViewAgent::setFrame(const StackFrame &frame)
|
||||
{
|
||||
d->frame = frame;
|
||||
if (!frame.function.isEmpty()) {
|
||||
QHash<QString, QString>::ConstIterator it =
|
||||
d->cache.find(frame.function + frame.file);
|
||||
if (!frame.function.isEmpty() && frame.function != _("??")) {
|
||||
QHash<QString, QString>::ConstIterator it = d->cache.find(frameKey(frame));
|
||||
if (it != d->cache.end()) {
|
||||
QString msg = QString::fromLatin1("Use cache dissassembler for %1 in %2")
|
||||
.arg(frame.function).arg(frame.file);
|
||||
qDebug() << msg;
|
||||
m_manager->showDebuggerOutput(msg);
|
||||
setContents(*it);
|
||||
return;
|
||||
}
|
||||
@@ -234,7 +243,7 @@ void DisassemblerViewAgent::setContents(const QString &contents)
|
||||
using namespace Core;
|
||||
using namespace TextEditor;
|
||||
|
||||
d->cache.insert(d->frame.function + d->frame.file, contents);
|
||||
d->cache.insert(frameKey(d->frame), contents);
|
||||
QPlainTextEdit *plainTextEdit = 0;
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
if (!d->editor) {
|
||||
@@ -273,6 +282,19 @@ void DisassemblerViewAgent::setContents(const QString &contents)
|
||||
}
|
||||
}
|
||||
|
||||
bool DisassemblerViewAgent::contentsCoversAddress(const QString &contents) const
|
||||
{
|
||||
QTC_ASSERT(d, return false);
|
||||
for (int pos = 0, line = 0; ; ++line, ++pos) {
|
||||
if (contents.midRef(pos, d->frame.address.size()) == d->frame.address)
|
||||
return true;
|
||||
pos = contents.indexOf('\n', pos + 1);
|
||||
if (pos == -1)
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString DisassemblerViewAgent::address() const
|
||||
{
|
||||
return d->frame.address;
|
||||
|
||||
Reference in New Issue
Block a user