2020-06-22 20:25:30 +00:00
|
|
|
#ifndef DECOMPILERCONTEXTMENU_H
|
|
|
|
#define DECOMPILERCONTEXTMENU_H
|
|
|
|
|
|
|
|
#include "core/Cutter.h"
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QKeySequence>
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
#include <r_util/r_annotated_code.h>
|
|
|
|
|
2020-06-22 20:25:30 +00:00
|
|
|
class DecompilerContextMenu : public QMenu
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
DecompilerContextMenu(QWidget *parent, MainWindow *mainWindow);
|
|
|
|
~DecompilerContextMenu();
|
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
bool getIsTogglingBreakpoints();
|
2020-07-16 08:56:38 +00:00
|
|
|
void setAnnotationHere(RCodeAnnotation *annotation);
|
2020-06-29 19:08:02 +00:00
|
|
|
|
2020-06-22 20:25:30 +00:00
|
|
|
signals:
|
|
|
|
void copy();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setOffset(RVA offset);
|
|
|
|
void setCanCopy(bool enabled);
|
2020-06-29 19:08:02 +00:00
|
|
|
void setFirstOffsetInLine(RVA firstOffset);
|
|
|
|
void setAvailableBreakpoints(QVector<RVA> offsetList);
|
|
|
|
|
2020-06-22 20:25:30 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void aboutToShowSlot();
|
2020-07-06 17:18:22 +00:00
|
|
|
void aboutToHideSlot();
|
2020-06-22 20:25:30 +00:00
|
|
|
|
|
|
|
void actionCopyTriggered();
|
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
void actionAddCommentTriggered();
|
|
|
|
void actionDeleteCommentTriggered();
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
void actionRenameThingHereTriggered();
|
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
void actionToggleBreakpointTriggered();
|
|
|
|
void actionAdvancedBreakpointTriggered();
|
|
|
|
|
|
|
|
void actionContinueUntilTriggered();
|
|
|
|
void actionSetPCTriggered();
|
2020-06-22 20:25:30 +00:00
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
private:
|
|
|
|
// Private variables
|
2020-06-22 20:25:30 +00:00
|
|
|
RVA offset;
|
2020-06-29 19:08:02 +00:00
|
|
|
RVA firstOffsetInLine;
|
|
|
|
bool isTogglingBreakpoints;
|
|
|
|
QVector<RVA> availableBreakpoints;
|
2020-06-22 20:25:30 +00:00
|
|
|
MainWindow *mainWindow;
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
RCodeAnnotation *annotationHere;
|
|
|
|
|
2020-06-22 20:25:30 +00:00
|
|
|
QAction actionCopy;
|
|
|
|
QAction *copySeparator;
|
2020-06-29 19:08:02 +00:00
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
QAction actionAddComment;
|
|
|
|
QAction actionDeleteComment;
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
QAction actionRenameThingHere;
|
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
QMenu *breakpointMenu;
|
|
|
|
QAction actionToggleBreakpoint;
|
|
|
|
QAction actionAdvancedBreakpoint;
|
|
|
|
|
|
|
|
QMenu *breakpointsInLineMenu;
|
|
|
|
|
|
|
|
QMenu *debugMenu;
|
|
|
|
QAction actionContinueUntil;
|
|
|
|
QAction actionSetPC;
|
|
|
|
|
|
|
|
// Private Functions
|
|
|
|
void setShortcutContextInActions(QMenu *menu);
|
|
|
|
void setupBreakpointsInLineMenu();
|
|
|
|
void setIsTogglingBreakpoints(bool isToggling);
|
|
|
|
|
|
|
|
// Set actions
|
2020-06-22 20:25:30 +00:00
|
|
|
void setActionCopy();
|
2020-06-29 19:08:02 +00:00
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
void setActionAddComment();
|
|
|
|
void setActionDeleteComment();
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
void setActionRenameThingHere();
|
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
void setActionToggleBreakpoint();
|
|
|
|
void setActionAdvancedBreakpoint();
|
|
|
|
|
|
|
|
void setActionContinueUntil();
|
|
|
|
void setActionSetPC();
|
|
|
|
|
|
|
|
// Add Menus
|
|
|
|
void addBreakpointMenu();
|
|
|
|
void addDebugMenu();
|
2020-06-22 20:25:30 +00:00
|
|
|
// I left out the following part from RAnnotatedCode. Probably, we will be returning/passing annotations
|
|
|
|
// from/to the function getThingUsedHere() and updateTargetMenuActions(). This block of comment will get removed in
|
|
|
|
// future PRs.
|
2020-06-29 19:08:02 +00:00
|
|
|
//
|
2020-06-22 20:25:30 +00:00
|
|
|
// struct ThingUsedHere {
|
|
|
|
// QString name;
|
|
|
|
// RVA offset;
|
|
|
|
// enum class Type {
|
|
|
|
// Var,
|
|
|
|
// Function,
|
|
|
|
// Flag,
|
|
|
|
// Address
|
|
|
|
// };
|
|
|
|
// Type type;
|
|
|
|
// };
|
|
|
|
// QVector<ThingUsedHere> getThingUsedHere(RVA offset);
|
|
|
|
|
|
|
|
// void updateTargetMenuActions(const QVector<ThingUsedHere> &targets);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DECOMPILERCONTEXTMENU_H
|