Commit 9febb0bc authored by hjk's avatar hjk
Browse files

debugger: remove old disassembler view and handler

It is replaced by a real editor in e82d6c7b.
parent e82d6c7b
......@@ -1257,8 +1257,13 @@ bool CdbDebugEnginePrivate::attemptBreakpointSynchronization(QString *errorMessa
return ok;
}
void CdbDebugEngine::reloadDisassembler()
void CdbDebugEngine::fetchDisassembler(DisassemblerViewAgent *agent,
const StackFrame &frame)
{
// was: void CdbDebugEngine::reloadDisassembler()
// use agent->address() to create a listing
/*
enum { ContextLines = 40 };
// Do we have a top stack frame?
const ULONG64 offset = m_d->m_currentStackTrace ? m_d->m_currentStackTrace->instructionOffset() : ULONG64(0);
......@@ -1283,6 +1288,7 @@ void CdbDebugEngine::reloadDisassembler()
} else {
dh->setLines(QList<DisassemblerLine>());
}
*/
}
void CdbDebugEngine::reloadModules()
......
......@@ -39,6 +39,7 @@ namespace Debugger {
namespace Internal {
class DebuggerManager;
class DisassemblerViewAgent;
class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
......@@ -86,7 +87,8 @@ public:
virtual void attemptBreakpointSynchronization();
virtual void reloadDisassembler();
virtual void fetchDisassembler(DisassemblerViewAgent *agent,
const StackFrame &frame);
virtual void reloadModules();
virtual void loadSymbols(const QString &moduleName);
......
......@@ -29,8 +29,6 @@ HEADERS += \
debuggerplugin.h \
debuggerrunner.h \
debuggertooltip.h \
disassemblerhandler.h \
disassemblerwindow.h \
watchutils.h \
idebuggerengine.h \
imports.h \
......@@ -59,8 +57,6 @@ SOURCES += \
debuggerplugin.cpp \
debuggerrunner.cpp \
debuggertooltip.cpp \
disassemblerhandler.cpp \
disassemblerwindow.cpp \
watchutils.cpp \
moduleshandler.cpp \
moduleswindow.cpp \
......
......@@ -35,7 +35,6 @@
#include "idebuggerengine.h"
#include "breakwindow.h"
#include "disassemblerwindow.h"
#include "debuggeroutputwindow.h"
#include "moduleswindow.h"
#include "registerwindow.h"
......@@ -44,7 +43,6 @@
#include "threadswindow.h"
#include "watchwindow.h"
#include "disassemblerhandler.h"
#include "breakhandler.h"
#include "moduleshandler.h"
#include "registerhandler.h"
......@@ -208,7 +206,6 @@ void DebuggerManager::init()
m_runControl = 0;
m_disassemblerHandler = 0;
m_modulesHandler = 0;
m_registerHandler = 0;
......@@ -216,7 +213,6 @@ void DebuggerManager::init()
m_statusLabel->setMinimumSize(QSize(30, 10));
m_breakWindow = new BreakWindow;
m_disassemblerWindow = new DisassemblerWindow;
m_modulesWindow = new ModulesWindow(this);
m_outputWindow = new DebuggerOutputWindow;
m_registerWindow = new RegisterWindow(this);
......@@ -252,14 +248,6 @@ void DebuggerManager::init()
connect(threadsView, SIGNAL(threadSelected(int)),
this, SLOT(selectThread(int)));
// Disassembler
m_disassemblerHandler = new DisassemblerHandler;
QAbstractItemView *disassemblerView =
qobject_cast<QAbstractItemView *>(m_disassemblerWindow);
disassemblerView->setModel(m_disassemblerHandler->model());
connect(m_disassemblerWindow, SIGNAL(reloadDisassemblerRequested()),
this, SLOT(reloadDisassembler()));
// Breakpoints
m_breakHandler = new BreakHandler(this);
QAbstractItemView *breakView =
......@@ -419,10 +407,6 @@ void DebuggerManager::init()
m_breakDock = m_mainWindow->addDockForWidget(m_breakWindow);
m_disassemblerDock = m_mainWindow->addDockForWidget(m_disassemblerWindow);
connect(m_disassemblerDock->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(reloadDisassembler()), Qt::QueuedConnection);
m_modulesDock = m_mainWindow->addDockForWidget(m_modulesWindow);
connect(m_modulesDock->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(reloadModules()), Qt::QueuedConnection);
......@@ -505,7 +489,6 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
}
m_mainWindow->tabifyDockWidget(m_watchDock, m_breakDock);
m_mainWindow->tabifyDockWidget(m_watchDock, m_disassemblerDock);
m_mainWindow->tabifyDockWidget(m_watchDock, m_modulesDock);
m_mainWindow->tabifyDockWidget(m_watchDock, m_outputDock);
m_mainWindow->tabifyDockWidget(m_watchDock, m_registerDock);
......@@ -516,7 +499,6 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
// saves cycles since the corresponding information won't be retrieved.
m_sourceFilesDock->hide();
m_registerDock->hide();
m_disassemblerDock->hide();
m_modulesDock->hide();
m_outputDock->hide();
m_mainWindow->setTrackingEnabled(true);
......@@ -613,7 +595,6 @@ void DebuggerManager::shutdown()
// Delete these manually before deleting the manager
// (who will delete the models for most views)
doDelete(m_breakWindow);
doDelete(m_disassemblerWindow);
doDelete(m_modulesWindow);
doDelete(m_outputWindow);
doDelete(m_registerWindow);
......@@ -625,7 +606,6 @@ void DebuggerManager::shutdown()
doDelete(m_localsWindow);
doDelete(m_breakHandler);
doDelete(m_disassemblerHandler);
doDelete(m_threadsHandler);
doDelete(m_modulesHandler);
doDelete(m_registerHandler);
......@@ -759,7 +739,7 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
return scriptEngine;
}
#ifndef Q_OS_WIN
#ifndef Q_OS_WIN
Q_UNUSED(settingsIdHint)
if (!gdbEngine) {
*errorMessage = msgEngineNotAvailable("Gdb Engine");
......@@ -876,7 +856,6 @@ void DebuggerManager::cleanupViews()
breakHandler()->setAllPending();
stackHandler()->removeAll();
threadsHandler()->removeAll();
disassemblerHandler()->removeAll();
modulesHandler()->removeAll();
watchHandler()->cleanup();
m_sourceFilesWindow->removeAll();
......@@ -1176,7 +1155,6 @@ void DebuggerManager::setBusyCursor(bool busy)
QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor);
m_breakWindow->setCursor(cursor);
m_disassemblerWindow->setCursor(cursor);
m_localsWindow->setCursor(cursor);
m_modulesWindow->setCursor(cursor);
m_outputWindow->setCursor(cursor);
......@@ -1308,25 +1286,6 @@ void DebuggerManager::stepByInstructionTriggered()
}
//////////////////////////////////////////////////////////////////////
//
// Disassembler specific stuff
//
//////////////////////////////////////////////////////////////////////
void DebuggerManager::reloadDisassembler()
{
if (m_engine && m_disassemblerDock && m_disassemblerDock->isVisible())
m_engine->reloadDisassembler();
}
void DebuggerManager::disassemblerDockToggled(bool on)
{
if (on)
reloadDisassembler();
}
//////////////////////////////////////////////////////////////////////
//
// Source files specific stuff
......
......@@ -73,7 +73,6 @@ class DebugMode;
class BreakHandler;
class BreakpointData;
class DisassemblerHandler;
class ModulesHandler;
class RegisterHandler;
class SourceFilesWindow;
......@@ -219,7 +218,6 @@ private:
virtual void notifyInferiorExited() = 0;
virtual void notifyInferiorPidChanged(qint64) = 0;
virtual DisassemblerHandler *disassemblerHandler() = 0;
virtual ModulesHandler *modulesHandler() = 0;
virtual BreakHandler *breakHandler() = 0;
virtual RegisterHandler *registerHandler() = 0;
......@@ -232,7 +230,6 @@ private:
virtual void showDebuggerOutput(int channel, const QString &msg) = 0;
virtual void showDebuggerInput(int channel, const QString &msg) = 0;
virtual void reloadDisassembler() = 0;
virtual void reloadModules() = 0;
virtual void reloadSourceFiles() = 0;
virtual void reloadRegisters() = 0;
......@@ -330,9 +327,6 @@ private slots:
void showDebuggerInput(int channel, const QString &msg);
void showApplicationOutput(const QString &data);
void reloadDisassembler();
void disassemblerDockToggled(bool on);
void reloadSourceFiles();
void sourceFilesDockToggled(bool on);
......@@ -353,7 +347,6 @@ private:
//
// Implementation of IDebuggerManagerAccessForEngines
//
DisassemblerHandler *disassemblerHandler() { return m_disassemblerHandler; }
ModulesHandler *modulesHandler() { return m_modulesHandler; }
BreakHandler *breakHandler() { return m_breakHandler; }
RegisterHandler *registerHandler() { return m_registerHandler; }
......@@ -438,7 +431,6 @@ private:
Core::Utils::FancyMainWindow *m_mainWindow;
QLabel *m_statusLabel;
QDockWidget *m_breakDock;
QDockWidget *m_disassemblerDock;
QDockWidget *m_modulesDock;
QDockWidget *m_outputDock;
QDockWidget *m_registerDock;
......@@ -448,7 +440,6 @@ private:
QDockWidget *m_watchDock;
BreakHandler *m_breakHandler;
DisassemblerHandler *m_disassemblerHandler;
ModulesHandler *m_modulesHandler;
RegisterHandler *m_registerHandler;
StackHandler *m_stackHandler;
......@@ -474,7 +465,6 @@ private:
QAction *m_reverseDirectionAction;
QWidget *m_breakWindow;
QWidget *m_disassemblerWindow;
QWidget *m_localsWindow;
QWidget *m_registerWindow;
QWidget *m_modulesWindow;
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 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 "disassemblerhandler.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QAbstractTableModel>
#include <QtGui/QIcon>
using namespace Debugger;
using namespace Debugger::Internal;
void DisassemblerLine::clear()
{
address.clear();
symbol.clear();
addressDisplay.clear();
symbolDisplay.clear();
mnemonic.clear();
}
//////////////////////////////////////////////////////////////////
//
// DisassemblerModel
//
//////////////////////////////////////////////////////////////////
/*! A model to represent the stack in a QTreeView. */
class Debugger::Internal::DisassemblerModel : public QAbstractTableModel
{
Q_OBJECT
public:
DisassemblerModel(QObject *parent);
// ItemModel
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
// Properties
void setLines(const QList<DisassemblerLine> &lines);
QList<DisassemblerLine> lines() const;
void setCurrentLine(int line) { m_currentLine = line; }
private:
friend class DisassemblerHandler;
QList<DisassemblerLine> m_lines;
int m_currentLine;
QIcon m_positionIcon;
QIcon m_emptyIcon;
};
DisassemblerModel::DisassemblerModel(QObject *parent)
: QAbstractTableModel(parent), m_currentLine(0)
{
m_emptyIcon = QIcon(":/debugger/images/empty.svg");
m_positionIcon = QIcon(":/debugger/images/location.svg");
}
int DisassemblerModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return m_lines.size();
}
int DisassemblerModel::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
return 3;
}
QVariant DisassemblerModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= m_lines.size())
return QVariant();
const DisassemblerLine &line = m_lines.at(index.row());
if (role == Qt::DisplayRole) {
switch (index.column()) {
case 0:
return line.addressDisplay;
case 1:
return line.symbolDisplay;
case 2:
return line.mnemonic;
}
} else if (role == Qt::ToolTipRole) {
return QString();
} else if (role == Qt::DecorationRole && index.column() == 0) {
// Return icon that indicates whether this is the active stack frame
return (index.row() == m_currentLine) ? m_positionIcon : m_emptyIcon;
}
return QVariant();
}
QVariant DisassemblerModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) {
case 1: return DisassemblerHandler::tr("Address");
case 2: return DisassemblerHandler::tr("Symbol");
case 3: return DisassemblerHandler::tr("Mnemonic");
};
}
return QVariant();
}
void DisassemblerModel::setLines(const QList<DisassemblerLine> &lines)
{
m_lines = lines;
if (m_currentLine >= m_lines.size())
m_currentLine = m_lines.size() - 1;
reset();
}
QList<DisassemblerLine> DisassemblerModel::lines() const
{
return m_lines;
}
//////////////////////////////////////////////////////////////////
//
// DisassemblerHandler
//
//////////////////////////////////////////////////////////////////
DisassemblerHandler::DisassemblerHandler()
{
m_model = new DisassemblerModel(this);
}
void DisassemblerHandler::removeAll()
{
m_model->m_lines.clear();
}
QAbstractItemModel *DisassemblerHandler::model() const
{
return m_model;
}
void DisassemblerHandler::setLines(const QList<DisassemblerLine> &lines)
{
m_model->setLines(lines);
}
QList<DisassemblerLine> DisassemblerHandler::lines() const
{
return m_model->lines();
}
void DisassemblerHandler::setCurrentLine(int line)
{
m_model->setCurrentLine(line);
}
#include "disassemblerhandler.moc"
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 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 DISASSEMBLERHANDLER_H
#define DISASSEMBLERHANDLER_H
#include <QtCore/QObject>
#include <QtCore/QAbstractItemModel>
#include <QtGui/QIcon>
namespace Debugger {
namespace Internal {
class DisassemblerLine
{
public:
void clear();
QString address;
QString symbol;
QString addressDisplay;
QString symbolDisplay;
QString mnemonic;
};
class DisassemblerModel;
class DisassemblerHandler : public QObject
{
Q_OBJECT
public:
DisassemblerHandler();
QAbstractItemModel *model() const;
public slots:
void removeAll();
void setLines(const QList<DisassemblerLine> &lines);
QList<DisassemblerLine> lines() const;
void setCurrentLine(int line);
private:
DisassemblerModel *m_model;
};
} // namespace Internal
} // namespace Debugger
#endif // DISASSEMBLERHANDLER_H
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 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 "disassemblerwindow.h"
#include "debuggeractions.h"
#include <QAction>
#include <QDebug>
#include <QHeaderView>
#include <QMenu>
#include <QResizeEvent>
using namespace Debugger::Internal;
DisassemblerWindow::DisassemblerWindow()
: m_alwaysResizeColumnsToContents(true), m_alwaysReloadContents(false)
{
QAction *act = theDebuggerAction(UseAlternatingRowColors);
setWindowTitle(tr("Disassembler"));
setSortingEnabled(false);
setAlternatingRowColors(act->isChecked());
setRootIsDecorated(false);
header()->hide();
connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool)));
}
void DisassemblerWindow::resizeEvent(QResizeEvent *ev)
{
//QHeaderView *hv = header();
//int totalSize = ev->size().width() - 110;
//hv->resizeSection(0, 60);
//hv->resizeSection(1, (totalSize * 50) / 100);
//hv->resizeSection(2, (totalSize * 50) / 100);
//hv->resizeSection(3, 50);
QTreeView::resizeEvent(ev);
}
void DisassemblerWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
QAction *act2 = new QAction(tr("Always adjust column widths to contents"), &menu);
act2->setCheckable(true);
// FIXME: make this a SavedAction
act2->setChecked(m_alwaysResizeColumnsToContents);
QAction *act3 = new QAction(tr("Reload disassembler listing"), &menu);
QAction *act4 = new QAction(tr("Always reload disassembler listing"), &menu);
act4->setCheckable(true);
act4->setChecked(m_alwaysReloadContents);
menu.addAction(act3);
//menu.addAction(act4);
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
menu.addSeparator();
menu.addAction(theDebuggerAction(SettingsDialog));