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:
|
2020-07-30 08:41:23 +00:00
|
|
|
void setCurHighlightedWord(QString word);
|
2020-06-22 20:25:30 +00:00
|
|
|
void setOffset(RVA offset);
|
2020-08-06 08:32:46 +00:00
|
|
|
void setDecompiledFunctionAddress(RVA functionAddr);
|
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-30 08:41:23 +00:00
|
|
|
void actionCopyInstructionAddressTriggered();
|
|
|
|
void actionCopyReferenceAddressTriggered();
|
2020-06-22 20:25:30 +00:00
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
void actionAddCommentTriggered();
|
|
|
|
void actionDeleteCommentTriggered();
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
void actionRenameThingHereTriggered();
|
2020-07-30 08:41:23 +00:00
|
|
|
void actionDeleteNameTriggered();
|
2020-07-16 08:56:38 +00:00
|
|
|
|
2020-08-06 08:32:46 +00:00
|
|
|
void actionEditFunctionVariablesTriggered();
|
|
|
|
|
2020-08-04 19:03:39 +00:00
|
|
|
void actionXRefsTriggered();
|
|
|
|
|
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-07-30 08:41:23 +00:00
|
|
|
QString curHighlightedWord;
|
2020-06-22 20:25:30 +00:00
|
|
|
RVA offset;
|
2020-08-06 08:32:46 +00:00
|
|
|
RVA decompiledFunctionAddress;
|
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;
|
2020-07-30 08:41:23 +00:00
|
|
|
QAction actionCopyInstructionAddress;
|
|
|
|
QAction actionCopyReferenceAddress;
|
2020-06-22 20:25:30 +00:00
|
|
|
QAction *copySeparator;
|
2020-06-29 19:08:02 +00:00
|
|
|
|
2020-07-30 08:41:23 +00:00
|
|
|
QAction actionShowInSubmenu;
|
|
|
|
QList<QAction *> showTargetMenuActions;
|
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
QAction actionAddComment;
|
|
|
|
QAction actionDeleteComment;
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
QAction actionRenameThingHere;
|
2020-07-30 08:41:23 +00:00
|
|
|
QAction actionDeleteName;
|
2020-07-16 08:56:38 +00:00
|
|
|
|
2020-08-06 08:32:46 +00:00
|
|
|
QAction actionEditFunctionVariables;
|
|
|
|
|
2020-08-04 19:03:39 +00:00
|
|
|
QAction actionXRefs;
|
|
|
|
|
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-30 08:41:23 +00:00
|
|
|
void setActionShowInSubmenu();
|
|
|
|
|
2020-07-06 17:18:22 +00:00
|
|
|
void setActionAddComment();
|
|
|
|
void setActionDeleteComment();
|
|
|
|
|
2020-08-04 19:03:39 +00:00
|
|
|
void setActionXRefs();
|
|
|
|
|
2020-07-16 08:56:38 +00:00
|
|
|
void setActionRenameThingHere();
|
2020-07-30 08:41:23 +00:00
|
|
|
void setActionDeleteName();
|
2020-07-16 08:56:38 +00:00
|
|
|
|
2020-08-06 08:32:46 +00:00
|
|
|
void setActionEditFunctionVariables();
|
|
|
|
|
2020-06-29 19:08:02 +00:00
|
|
|
void setActionToggleBreakpoint();
|
|
|
|
void setActionAdvancedBreakpoint();
|
|
|
|
|
|
|
|
void setActionContinueUntil();
|
|
|
|
void setActionSetPC();
|
|
|
|
|
|
|
|
// Add Menus
|
|
|
|
void addBreakpointMenu();
|
|
|
|
void addDebugMenu();
|
2020-08-06 08:32:46 +00:00
|
|
|
|
2020-07-30 08:41:23 +00:00
|
|
|
void updateTargetMenuActions();
|
2020-08-06 08:32:46 +00:00
|
|
|
|
|
|
|
bool isFunctionVariable();
|
|
|
|
bool variablePresentInR2();
|
2020-06-22 20:25:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DECOMPILERCONTEXTMENU_H
|