forked from qt-creator/qt-creator
Adapt Lldb to dissasembler changes
This commit is contained in:
@@ -35,6 +35,7 @@ HEADERS += breakhandler.h \
|
||||
debuggerstringutils.h \
|
||||
debuggertooltip.h \
|
||||
debuggeruiswitcher.h \
|
||||
disassemblerlines.h \
|
||||
logwindow.h \
|
||||
moduleshandler.h \
|
||||
moduleswindow.h \
|
||||
@@ -73,6 +74,7 @@ SOURCES += breakhandler.cpp \
|
||||
debuggerstreamops.cpp \
|
||||
debuggertooltip.cpp \
|
||||
debuggeruiswitcher.cpp \
|
||||
disassemblerlines.cpp \
|
||||
logwindow.cpp \
|
||||
moduleshandler.cpp \
|
||||
moduleswindow.cpp \
|
||||
|
||||
@@ -405,55 +405,5 @@ quint64 DisassemblerViewAgent::addressFromDisassemblyLine(const QString &line)
|
||||
return DisassemblerLine(line).address;
|
||||
}
|
||||
|
||||
DisassemblerLine::DisassemblerLine(const QString &unparsed)
|
||||
{
|
||||
// Mac gdb has an overflow reporting 64bit addresses causing the instruction
|
||||
// to follow the last digit "0x000000013fff4810mov 1,1". Truncate here.
|
||||
const int pos = qMin(unparsed.indexOf(QLatin1Char(' ')), 19);
|
||||
if (pos < 0) {
|
||||
address = 0;
|
||||
data = 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")))
|
||||
addr.remove(0, 2);
|
||||
bool ok;
|
||||
address = addr.toULongLong(&ok, 16);
|
||||
if (address)
|
||||
data = unparsed.mid(pos + 1);
|
||||
else
|
||||
data = unparsed;
|
||||
}
|
||||
|
||||
int DisassemblerLines::lineForAddress(quint64 address) const
|
||||
{
|
||||
return m_rowCache.value(address);
|
||||
}
|
||||
|
||||
bool DisassemblerLines::coversAddress(quint64 address) const
|
||||
{
|
||||
return m_rowCache.value(address) != 0;
|
||||
}
|
||||
|
||||
void DisassemblerLines::appendComment(const QString &comment)
|
||||
{
|
||||
DisassemblerLine dl;
|
||||
dl.data = comment;
|
||||
m_data.append(dl);
|
||||
}
|
||||
|
||||
void DisassemblerLines::appendLine(const DisassemblerLine &dl)
|
||||
{
|
||||
m_data.append(dl);
|
||||
m_rowCache[dl.address] = m_data.size();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include "disassemblerlines.h"
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
}
|
||||
@@ -76,34 +78,6 @@ private:
|
||||
QPointer<Debugger::DebuggerEngine> m_engine;
|
||||
};
|
||||
|
||||
class DisassemblerLine
|
||||
{
|
||||
public:
|
||||
DisassemblerLine() : address(0) {}
|
||||
DisassemblerLine(const QString &unparsed);
|
||||
|
||||
quint64 address;
|
||||
QString data;
|
||||
};
|
||||
|
||||
class DisassemblerLines
|
||||
{
|
||||
public:
|
||||
DisassemblerLines() {}
|
||||
|
||||
bool coversAddress(quint64 address) const;
|
||||
void appendLine(const DisassemblerLine &dl);
|
||||
void appendComment(const QString &comment);
|
||||
int size() const { return m_data.size(); }
|
||||
const DisassemblerLine &at(int i) const { return m_data.at(i); }
|
||||
int lineForAddress(quint64 address) const;
|
||||
|
||||
private:
|
||||
friend class DisassemblerViewAgent;
|
||||
QVector<DisassemblerLine> m_data;
|
||||
QHash<quint64, int> m_rowCache;
|
||||
};
|
||||
|
||||
class DisassemblerViewAgent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -242,6 +242,47 @@ QDataStream &operator>>(QDataStream &stream, WatchData &wd)
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream& stream, const DisassemblerLine &o)
|
||||
{
|
||||
stream << o.address;
|
||||
stream << o.data;
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream& stream, DisassemblerLine &o)
|
||||
{
|
||||
stream >> o.address;
|
||||
stream >> o.data;
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream& stream, const DisassemblerLines &o)
|
||||
{
|
||||
stream << quint64(o.size());
|
||||
for (int i = 0; i < o.size(); i++)
|
||||
{
|
||||
stream << o.at(i);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream& stream, DisassemblerLines &o)
|
||||
{
|
||||
DisassemblerLines r;
|
||||
quint64 count;
|
||||
stream >> count;
|
||||
for (quint64 i = 0; i < count; i++)
|
||||
{
|
||||
DisassemblerLine line;
|
||||
stream >> line;
|
||||
r.appendLine(line);
|
||||
}
|
||||
o = r;
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "stackframe.h"
|
||||
#include "threaddata.h"
|
||||
#include "watchdata.h"
|
||||
#include "disassemblerlines.h"
|
||||
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QtCore/QVector>
|
||||
@@ -55,6 +56,10 @@ QDataStream &operator<<(QDataStream& stream, const BreakpointResponse &data);
|
||||
QDataStream &operator>>(QDataStream& stream, BreakpointResponse &data);
|
||||
QDataStream &operator<<(QDataStream& stream, const WatchData &data);
|
||||
QDataStream &operator>>(QDataStream& stream, WatchData &data);
|
||||
QDataStream &operator<<(QDataStream& stream, const DisassemblerLine &o);
|
||||
QDataStream &operator>>(QDataStream& stream, DisassemblerLine &o);
|
||||
QDataStream &operator<<(QDataStream& stream, const DisassemblerLines &o);
|
||||
QDataStream &operator>>(QDataStream& stream, DisassemblerLines &o);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
86
src/plugins/debugger/disassemblerlines.cpp
Normal file
86
src/plugins/debugger/disassemblerlines.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "disassemblerlines.h"
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
DisassemblerLine::DisassemblerLine(const QString &unparsed)
|
||||
{
|
||||
// Mac gdb has an overflow reporting 64bit addresses causing the instruction
|
||||
// to follow the last digit "0x000000013fff4810mov 1,1". Truncate here.
|
||||
const int pos = qMin(unparsed.indexOf(QLatin1Char(' ')), 19);
|
||||
if (pos < 0) {
|
||||
address = 0;
|
||||
data = 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")))
|
||||
addr.remove(0, 2);
|
||||
bool ok;
|
||||
address = addr.toULongLong(&ok, 16);
|
||||
if (address)
|
||||
data = unparsed.mid(pos + 1);
|
||||
else
|
||||
data = unparsed;
|
||||
}
|
||||
|
||||
int DisassemblerLines::lineForAddress(quint64 address) const
|
||||
{
|
||||
return m_rowCache.value(address);
|
||||
}
|
||||
|
||||
bool DisassemblerLines::coversAddress(quint64 address) const
|
||||
{
|
||||
return m_rowCache.value(address) != 0;
|
||||
}
|
||||
|
||||
void DisassemblerLines::appendComment(const QString &comment)
|
||||
{
|
||||
DisassemblerLine dl;
|
||||
dl.data = comment;
|
||||
m_data.append(dl);
|
||||
}
|
||||
|
||||
void DisassemblerLines::appendLine(const DisassemblerLine &dl)
|
||||
{
|
||||
m_data.append(dl);
|
||||
m_rowCache[dl.address] = m_data.size();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
71
src/plugins/debugger/disassemblerlines.h
Normal file
71
src/plugins/debugger/disassemblerlines.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef DEBUGGER_disassemblerlines_H
|
||||
#define DEBUGGER_disassemblerlines_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DisassemblerLine
|
||||
{
|
||||
public:
|
||||
DisassemblerLine() : address(0) {}
|
||||
DisassemblerLine(const QString &unparsed);
|
||||
|
||||
quint64 address;
|
||||
QString data;
|
||||
};
|
||||
|
||||
class DisassemblerLines
|
||||
{
|
||||
public:
|
||||
DisassemblerLines() {}
|
||||
|
||||
bool coversAddress(quint64 address) const;
|
||||
void appendLine(const DisassemblerLine &dl);
|
||||
void appendComment(const QString &comment);
|
||||
int size() const { return m_data.size(); }
|
||||
const DisassemblerLine &at(int i) const { return m_data.at(i); }
|
||||
int lineForAddress(quint64 address) const;
|
||||
|
||||
private:
|
||||
friend class DisassemblerViewAgent;
|
||||
QVector<DisassemblerLine> m_data;
|
||||
QHash<quint64, int> m_rowCache;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
1
src/plugins/debugger/lldb/guest/lldb
Submodule
1
src/plugins/debugger/lldb/guest/lldb
Submodule
Submodule src/plugins/debugger/lldb/guest/lldb added at d75343c3ae
@@ -376,8 +376,12 @@ void LLDBEngineGuest::disassemble(quint64 pc)
|
||||
for (uint j = 0; j < m_currentThread.GetNumFrames(); j++) {
|
||||
lldb::SBFrame fr = m_currentThread.GetFrameAtIndex(j);
|
||||
if (pc == fr.GetPCAddress().GetLoadAddress(*m_target)) {
|
||||
disassembled(pc, QString::fromLocal8Bit(fr.Disassemble()));
|
||||
return;
|
||||
QString linesStr = QString::fromLocal8Bit(fr.Disassemble());
|
||||
DisassemblerLines lines;
|
||||
foreach (const QString &lineStr, linesStr.split(QLatin1Char('\n'))) {
|
||||
lines.appendLine(DisassemblerLine(lineStr));
|
||||
}
|
||||
disassembled(pc, lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ HEADERS += ../ipcengineguest.h \
|
||||
../breakpoint.h \
|
||||
../watchdata.h \
|
||||
../stackframe.h \
|
||||
../disassemblerlines.h \
|
||||
lldbengineguest.h
|
||||
|
||||
SOURCES += ../ipcengineguest.cpp \
|
||||
@@ -28,6 +29,7 @@ SOURCES += ../ipcengineguest.cpp \
|
||||
../breakpoint.cpp \
|
||||
../watchdata.cpp \
|
||||
../stackframe.cpp \
|
||||
../disassemblerlines.cpp \
|
||||
lldbengineguest.cpp \
|
||||
main.cpp
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ void IPCEngineGuest::listThreads(const Threads &threads)
|
||||
rpcCall(ListThreads, p);
|
||||
}
|
||||
|
||||
void IPCEngineGuest::disassembled(quint64 pc, const QString &da)
|
||||
void IPCEngineGuest::disassembled(quint64 pc, const DisassemblerLines &da)
|
||||
{
|
||||
QByteArray p;
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "breakhandler.h"
|
||||
#include "debuggerengine.h"
|
||||
#include "disassemblerlines.h"
|
||||
#include "stackhandler.h"
|
||||
#include "threadshandler.h"
|
||||
|
||||
@@ -152,7 +153,7 @@ public:
|
||||
void currentThreadChanged(qint64 token);
|
||||
void listFrames(const StackFrames &);
|
||||
void listThreads(const Threads &);
|
||||
void disassembled(quint64 pc, const QString &da);
|
||||
void disassembled(quint64 pc, const DisassemblerLines &da);
|
||||
|
||||
void notifyAddBreakpointOk(BreakpointId id);
|
||||
void notifyAddBreakpointFailed(BreakpointId id);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ipcengineguest.h"
|
||||
#include "breakhandler.h"
|
||||
#include "breakpoint.h"
|
||||
#include "disassemblerlines.h"
|
||||
#include "moduleshandler.h"
|
||||
#include "registerhandler.h"
|
||||
#include "stackhandler.h"
|
||||
@@ -443,12 +444,12 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
|
||||
QDataStream s(payload);
|
||||
SET_NATIVE_BYTE_ORDER(s);
|
||||
quint64 pc;
|
||||
QString da;
|
||||
DisassemblerLines lines;
|
||||
s >> pc;
|
||||
s >> da;
|
||||
//DisassemblerViewAgent *view = m_frameToDisassemblerAgent.take(pc);
|
||||
//if (view)
|
||||
// view->setContents(da);
|
||||
s >> lines;
|
||||
DisassemblerViewAgent *view = m_frameToDisassemblerAgent.take(pc);
|
||||
if (view)
|
||||
view->setContents(lines);
|
||||
}
|
||||
break;
|
||||
case IPCEngineGuest::UpdateWatchData:
|
||||
|
||||
Reference in New Issue
Block a user