1
0
Fork 0

Restore the order of menu actions in disassembly

This commit is contained in:
torusrxxx 2020-11-20 20:11:56 +08:00
parent 9e901cd8eb
commit d2f426f9de
No known key found for this signature in database
GPG Key ID: A795C73A0F1CFADD
4 changed files with 35 additions and 30 deletions

View File

@ -311,7 +311,7 @@ void CPUDisassembly::setupRightClickContextMenu()
{
return rvaToVa(getInitialSelection());
});
mCommonActions->build(mMenuBuilder, CommonActions::ActionBreakpoint | CommonActions::ActionMemoryMap | CommonActions::ActionGraph | CommonActions::ActionComment | CommonActions::ActionBookmark);
mCommonActions->build(mMenuBuilder, CommonActions::ActionBreakpoint);
mMenuBuilder->addMenu(makeMenu(DIcon("dump.png"), tr("&Follow in Dump")), [this](QMenu * menu)
{
@ -325,7 +325,7 @@ void CPUDisassembly::setupRightClickContextMenu()
return menu->actions().length() != 0; //only add this menu if there is something to follow
});
//mMenuBuilder->addAction(makeShortcutAction(DIcon("memmap_find_address_page.png"), tr("Follow in Memory Map"), SLOT(followInMemoryMapSlot()), "ActionFollowMemMap"));
mCommonActions->build(mMenuBuilder, CommonActions::ActionMemoryMap | CommonActions::ActionGraph);
mMenuBuilder->addAction(makeShortcutAction(DIcon("source.png"), tr("Open Source File"), SLOT(openSourceSlot()), "ActionOpenSourceFile"), [this](QMenu*)
{
@ -378,6 +378,7 @@ void CPUDisassembly::setupRightClickContextMenu()
return DbgMemIsValidReadPtr(addr);
});
mMenuBuilder->addMenu(makeMenu(DIcon("label.png"), tr("Label")), labelMenu);
mCommonActions->build(mMenuBuilder, CommonActions::ActionComment | CommonActions::ActionBookmark);
QAction* traceRecordDisable = makeAction(DIcon("close-all-tabs.png"), tr("Disable"), SLOT(ActionTraceRecordDisableSlot()));
QAction* traceRecordEnableBit = makeAction(DIcon("bit.png"), tr("Bit"), SLOT(ActionTraceRecordBitSlot()));

View File

@ -194,6 +194,7 @@ QWidget* CommonActions::widgetparent()
}
// Actions slots
// Follow in disassembly
void CommonActions::followDisassemblySlot()
{
duint cip = mGetSelection();
@ -283,6 +284,7 @@ void CommonActions::setBookmarkSlot()
GuiUpdateAllViews();
}
// Give a warning about the selected address is not executable
bool CommonActions::WarningBoxNotExecutable(const QString & text, duint wVA)
{
if(DbgFunctions()->IsDepEnabled() && !DbgFunctions()->MemIsCodePage(wVA, false))
@ -318,6 +320,7 @@ void CommonActions::toggleInt3BPActionSlot()
//emit Disassembly::repainted();
}
// Display the edit breakpoint dialog
void CommonActions::editSoftBpActionSlot()
{
auto selection = mGetSelection();

View File

@ -14,34 +14,34 @@ class CommonActions : public QObject, public ActionHelperProxy
public:
typedef enum
{
ActionDisasm = 1,
ActionDisasmMore = 1 << 1,
ActionDisasmDump = 1 << 2,
ActionDisasmDumpMore = 1 << 3,
ActionDisasmData = 1 << 4,
ActionDump = 1 << 5,
ActionDumpMore = 1 << 6,
ActionDumpN = 1 << 7,
ActionDumpData = 1 << 8,
ActionStackDump = 1 << 9,
ActionMemoryMap = 1 << 10,
ActionGraph = 1 << 11,
ActionBreakpoint = 1 << 12,
ActionMemoryBreakpoint = 1 << 13,
ActionMnemonicHelp = 1 << 14,
ActionLabel = 1 << 15,
ActionLabelMore = 1 << 16,
ActionComment = 1 << 17,
ActionCommentMore = 1 << 18,
ActionBookmark = 1 << 19,
ActionBookmarkMore = 1 << 20,
ActionFindref = 1 << 21,
ActionFindrefMore = 1 << 22,
ActionXref = 1 << 23,
ActionXrefMore = 1 << 24,
ActionNewOrigin = 1 << 25,
ActionNewThread = 1 << 26,
ActionWatch = 1 << 27
ActionDisasm = 1, // Follow in Disassembly
ActionDisasmMore = 1 << 1, // Follow in Disassembly (submenu)
ActionDisasmDump = 1 << 2, // Follow in Dump in Disassembly Mode
ActionDisasmDumpMore = 1 << 3, // Follow in Dump in Disassembly Mode (submenu)
ActionDisasmData = 1 << 4, // Follow DWORD in Disassembly
ActionDump = 1 << 5, // Follow in Dump
ActionDumpMore = 1 << 6, // Follow in Dump (submenu)
ActionDumpN = 1 << 7, // Follow in Dump N (submenu)
ActionDumpData = 1 << 8, // Follow DWORD in Dump
ActionStackDump = 1 << 9, // Follow in Stack
ActionMemoryMap = 1 << 10, // Follow in Memory Map
ActionGraph = 1 << 11, // Graph
ActionBreakpoint = 1 << 12, // Breakpoint
ActionMemoryBreakpoint = 1 << 13, // Memory Breakpoint
ActionMnemonicHelp = 1 << 14, // Mnemonic Help
ActionLabel = 1 << 15, // Label
ActionLabelMore = 1 << 16, // Label (submenu)
ActionComment = 1 << 17, // Comment
ActionCommentMore = 1 << 18, // Comment (submenu)
ActionBookmark = 1 << 19, // Bookmark
ActionBookmarkMore = 1 << 20, // Bookmark (submenu)
ActionFindref = 1 << 21, // Find references
ActionFindrefMore = 1 << 22, // Find references (submenu)
ActionXref = 1 << 23, // Xref
ActionXrefMore = 1 << 24, // Xref (submenu)
ActionNewOrigin = 1 << 25, // Set New Origin Here
ActionNewThread = 1 << 26, // Create New Thread Here
ActionWatch = 1 << 27 // Watch DWORD
} CommonActionsList;
using GetSelectionFunc = std::function<duint()>;

View File

@ -173,6 +173,7 @@ QIcon getFileIcon(QString file)
return result;
}
//Export table in CSV. TODO: Display a dialog where the user choose what column to export and in which encoding
bool ExportCSV(dsint rows, dsint columns, std::vector<QString> headers, std::function<QString(dsint, dsint)> getCellContent)
{
BrowseDialog browse(nullptr, QApplication::translate("ExportCSV", "Export data in CSV format"), QApplication::translate("ExportCSV", "Enter the CSV file name to export"), QApplication::translate("ExportCSV", "CSV files (*.csv);;All files (*.*)"), QApplication::applicationDirPath() + QDir::separator() + "db", true);