1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
/*
* GDB Debugger Support
*
* Copyright 1999 John Birch <jbb@kdevelop.org>
* Copyright 2007 Hamish Rodda <rodda@kde.org>
* Copyright 2013 Vlas Puhov <vlas.puhov@mail.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DISASSEMBLEWIDGET_H_
#define _DISASSEMBLEWIDGET_H_
#include "mi/mi.h"
#include <QActionGroup>
#include <QTreeWidget>
#include <QUrl>
#include <KConfigGroup>
#include "ui_selectaddressdialog.h"
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
class QSplitter;
namespace KDevelop {
class IDebugSession;
}
namespace KDevMI {
class RegistersManager;
class SelectAddressDialog : public QDialog
{
Q_OBJECT
public:
explicit SelectAddressDialog(QWidget *parent = nullptr);
QString address() const;
void setAddress(const QString& address);
bool hasValidAddress() const;
void updateOkState();
private Q_SLOTS:
void validateInput();
void itemSelected();
private:
Ui::SelectAddressDialog m_ui;
};
class DisassembleWidget;
enum DisassemblyFlavor {
DisassemblyFlavorUnknown = -1,
DisassemblyFlavorATT = 0,
DisassemblyFlavorIntel,
};
class DisassembleWindow : public QTreeWidget
{
Q_OBJECT
public:
DisassembleWindow(QWidget *parent, DisassembleWidget* widget);
void setDisassemblyFlavor(DisassemblyFlavor flavor);
protected:
void contextMenuEvent(QContextMenuEvent *e) override;
private:
QAction* m_selectAddrAction;
QAction* m_jumpToLocation;
QAction* m_runUntilCursor;
QAction* m_disassemblyFlavorAtt;
QAction* m_disassemblyFlavorIntel;
QActionGroup* m_disassemblyFlavorActionGroup;
};
class MIDebuggerPlugin;
class DisassembleWidget : public QWidget
{
Q_OBJECT
public:
enum Columns {
Icon,
Address,
Function,
Instruction,
ColumnCount
};
explicit DisassembleWidget( MIDebuggerPlugin* plugin, QWidget *parent=nullptr );
~DisassembleWidget() override;
Q_SIGNALS:
void requestRaise();
public Q_SLOTS:
void slotActivate(bool activate);
void slotDeactivate();
void slotShowStepInSource(const QUrl &fileName, int lineNum, const QString &address);
void slotChangeAddress();
///Disassembles code at @p address and updates registers
void update(const QString &address);
void jumpToCursor();
void runToCursor();
void setDisassemblyFlavor(QAction* action);
private Q_SLOTS:
void currentSessionChanged(KDevelop::IDebugSession* session);
protected:
void showEvent(QShowEvent*) override;
void hideEvent(QHideEvent*) override;
void enableControls(bool enabled);
private:
bool displayCurrent();
void updateDisassemblyFlavor();
/// Disassembles memory region from..to
/// if from is empty current execution position is used
/// if to is empty, 256 bytes range is taken
void disassembleMemoryRegion(const QString& from=QString(),
const QString& to=QString() );
/// callbacks for GDBCommands
void disassembleMemoryHandler(const MI::ResultRecord& r);
void updateExecutionAddressHandler(const MI::ResultRecord& r);
void setDisassemblyFlavorHandler(const MI::ResultRecord& r);
void showDisassemblyFlavorHandler(const MI::ResultRecord& r);
//for str to uint conversion.
bool ok;
bool active_;
unsigned long lower_;
unsigned long upper_;
unsigned long address_;
RegistersManager* m_registersManager ;
DisassembleWindow * m_disassembleWindow;
SelectAddressDialog* m_dlg;
KConfigGroup m_config;
QSplitter *m_splitter;
};
} // end of namespace KDevMI
#endif
|