"Fossies" - the Fresh Open Source Software Archive

Member "cutter-1.10.3/src/menus/DisassemblyContextMenu.h" (8 May 2020, 6516 Bytes) of package /linux/privat/cutter-1.10.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "DisassemblyContextMenu.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.10.2_vs_1.10.3.

    1 #ifndef DISASSEMBLYCONTEXTMENU_H
    2 #define DISASSEMBLYCONTEXTMENU_H
    3 
    4 #include "core/Cutter.h"
    5 #include "common/IOModesController.h"
    6 #include <QMenu>
    7 #include <QKeySequence>
    8 
    9 class DisassemblyContextMenu : public QMenu
   10 {
   11     Q_OBJECT
   12 
   13 public:
   14     DisassemblyContextMenu(QWidget *parent, MainWindow *mainWindow);
   15     ~DisassemblyContextMenu();
   16 
   17 signals:
   18     void copy();
   19 
   20 public slots:
   21     void setOffset(RVA offset);
   22     void setCanCopy(bool enabled);
   23 
   24     /**
   25      * @brief Sets the value of curHighlightedWord
   26      * @param text The current highlighted word
   27      */
   28     void setCurHighlightedWord(const QString &text);
   29 
   30 private slots:
   31     void aboutToShowSlot();
   32 
   33     void on_actionEditFunction_triggered();
   34     void on_actionEditInstruction_triggered();
   35     void on_actionNopInstruction_triggered();
   36     void on_actionJmpReverse_triggered();
   37     void on_actionEditBytes_triggered();
   38     void showReverseJmpQuery();
   39 
   40     void on_actionCopy_triggered();
   41     void on_actionCopyAddr_triggered();
   42     void on_actionAddComment_triggered();
   43     void on_actionAnalyzeFunction_triggered();
   44     void on_actionAddFlag_triggered();
   45     void on_actionRename_triggered();
   46     void on_actionRenameUsedHere_triggered();
   47     void on_actionSetFunctionVarTypes_triggered();
   48     void on_actionXRefs_triggered();
   49     void on_actionDisplayOptions_triggered();
   50 
   51     void on_actionDeleteComment_triggered();
   52     void on_actionDeleteFlag_triggered();
   53     void on_actionDeleteFunction_triggered();
   54 
   55     void on_actionAddBreakpoint_triggered();
   56     void on_actionAdvancedBreakpoint_triggered();
   57     void on_actionContinueUntil_triggered();
   58     void on_actionSetPC_triggered();
   59 
   60     void on_actionSetToCode_triggered();
   61     void on_actionSetAsString_triggered();
   62     void on_actionSetAsStringRemove_triggered();
   63     void on_actionSetAsStringAdvanced_triggered();
   64     void on_actionSetToData_triggered();
   65     void on_actionSetToDataEx_triggered();
   66 
   67     /**
   68      * @brief Executed on selecting an offset from the structureOffsetMenu
   69      * Uses the applyStructureOffset() function of CutterCore to apply the
   70      * structure offset
   71      * \param action The action which trigered the event
   72      */
   73     void on_actionStructureOffsetMenu_triggered(QAction *action);
   74 
   75     /**
   76      * @brief Executed on selecting the "Link Type to Address" option
   77      * Opens the LinkTypeDialog box from where the user can link the address
   78      * to a type
   79      */
   80     void on_actionLinkType_triggered();
   81 
   82 private:
   83     QKeySequence getCopySequence() const;
   84     QKeySequence getCommentSequence() const;
   85     QKeySequence getCopyAddressSequence() const;
   86     QKeySequence getSetToCodeSequence() const;
   87     QKeySequence getSetAsStringSequence() const;
   88     QKeySequence getSetToDataSequence() const;
   89     QKeySequence getSetToDataExSequence() const;
   90     QKeySequence getAddFlagSequence() const;
   91     QKeySequence getRenameSequence() const;
   92     QKeySequence getRenameUsedHereSequence() const;
   93     QKeySequence getRetypeSequence() const;
   94     QKeySequence getXRefSequence() const;
   95     QKeySequence getDisplayOptionsSequence() const;
   96     QKeySequence getDefineNewFunctionSequence() const;
   97     QKeySequence getUndefineFunctionSequence() const;
   98     QKeySequence getEditFunctionSequence() const;
   99     QList<QKeySequence> getAddBPSequence() const;
  100 
  101     /**
  102      * @return the shortcut key for "Link Type to Address" option
  103      */
  104     QKeySequence getLinkTypeSequence() const;
  105 
  106 
  107     RVA offset;
  108     bool canCopy;
  109     QString curHighlightedWord; // The current highlighted word
  110     MainWindow *mainWindow;
  111     IOModesController ioModesController;
  112 
  113     QList<QAction *> anonymousActions;
  114 
  115     QMenu *editMenu;
  116     QAction actionEditInstruction;
  117     QAction actionNopInstruction;
  118     QAction actionJmpReverse;
  119     QAction actionEditBytes;
  120 
  121     QAction actionCopy;
  122     QAction *copySeparator;
  123     QAction actionCopyAddr;
  124 
  125 
  126     QAction actionAddComment;
  127     QAction actionAddFlag;
  128     QAction actionAnalyzeFunction;
  129     QAction actionEditFunction;
  130     QAction actionRename;
  131     QAction actionRenameUsedHere;
  132     QAction actionSetFunctionVarTypes;
  133     QAction actionXRefs;
  134     QAction actionDisplayOptions;
  135 
  136     QAction actionDeleteComment;
  137     QAction actionDeleteFlag;
  138     QAction actionDeleteFunction;
  139 
  140     QMenu *structureOffsetMenu;
  141 
  142     QAction actionLinkType;
  143 
  144     QMenu *setBaseMenu;
  145     QAction actionSetBaseBinary;
  146     QAction actionSetBaseOctal;
  147     QAction actionSetBaseDecimal;
  148     QAction actionSetBaseHexadecimal;
  149     QAction actionSetBasePort;
  150     QAction actionSetBaseIPAddr;
  151     QAction actionSetBaseSyscall;
  152     QAction actionSetBaseString;
  153 
  154     QMenu *setBitsMenu;
  155     QAction actionSetBits16;
  156     QAction actionSetBits32;
  157     QAction actionSetBits64;
  158 
  159     QMenu *debugMenu;
  160     QAction actionContinueUntil;
  161     QAction actionSetPC;
  162 
  163     QMenu *breakpointMenu;
  164     QAction actionAddBreakpoint;
  165     QAction actionAdvancedBreakpoint;
  166 
  167     QAction actionSetToCode;
  168 
  169     QAction actionSetAsStringAuto;
  170     QAction actionSetAsStringRemove;
  171     QAction actionSetAsStringAdvanced;
  172 
  173     QMenu *setToDataMenu;
  174     QMenu *setAsMenu;
  175     QMenu *setAsString;
  176     QAction actionSetToDataEx;
  177     QAction actionSetToDataByte;
  178     QAction actionSetToDataWord;
  179     QAction actionSetToDataDword;
  180     QAction actionSetToDataQword;
  181 
  182     QAction showInSubmenu;
  183     QList<QAction*> showTargetMenuActions;
  184     QMenu *pluginMenu = nullptr;
  185     QAction *pluginActionMenuAction = nullptr;
  186 
  187     // For creating anonymous entries (that are always visible)
  188     QAction *addAnonymousAction(QString name, const char *slot, QKeySequence shortcut);
  189 
  190     void initAction(QAction *action, QString name, const char *slot = nullptr);
  191     void initAction(QAction *action, QString name, const char *slot, QKeySequence keySequence);
  192     void initAction(QAction *action, QString name, const char *slot, QList<QKeySequence> keySequence);
  193 
  194     void setBase(QString base);
  195     void setToData(int size, int repeat = 1);
  196     void setBits(int bits);
  197 
  198     void addSetBaseMenu();
  199     void addSetBitsMenu();
  200     void addSetAsMenu();
  201     void addSetToDataMenu();
  202     void addEditMenu();
  203     void addBreakpointMenu();
  204     void addDebugMenu();
  205 
  206     struct ThingUsedHere {
  207         QString name;
  208         RVA offset;
  209         enum class Type {
  210             Var,
  211             Function,
  212             Flag,
  213             Address
  214         };
  215         Type type;
  216     };
  217     QVector<ThingUsedHere> getThingUsedHere(RVA offset);
  218 
  219     void updateTargetMenuActions(const QVector<ThingUsedHere> &targets);
  220 };
  221 #endif // DISASSEMBLYCONTEXTMENU_H