1
0
Fork 0

Save columns in trace

This commit is contained in:
torusrxxx 2020-08-19 23:06:49 +08:00 committed by Duncan Ogilvie
parent 81b5b518fd
commit c8e3a66fda
4 changed files with 33 additions and 34 deletions

View File

@ -91,44 +91,17 @@ void LocalVarsView::setupContextMenu()
mMenu->addSeparator();
MenuBuilder* mBaseRegisters = new MenuBuilder(this);
#ifdef _WIN64
baseRegisters[0] = new QAction("RAX", this);
baseRegisters[1] = new QAction("RBX", this);
baseRegisters[2] = new QAction("RCX", this);
baseRegisters[3] = new QAction("RDX", this);
baseRegisters[4] = new QAction("RBP", this);
baseRegisters[5] = new QAction("RSP", this);
baseRegisters[6] = new QAction("RSI", this);
baseRegisters[7] = new QAction("RDI", this);
baseRegisters[8] = new QAction("R8", this);
baseRegisters[9] = new QAction("R9", this);
baseRegisters[10] = new QAction("R10", this);
baseRegisters[11] = new QAction("R11", this);
baseRegisters[12] = new QAction("R12", this);
baseRegisters[13] = new QAction("R13", this);
baseRegisters[14] = new QAction("R14", this);
baseRegisters[15] = new QAction("R15", this);
for(char i = 0; i < 16; i++)
{
connect(baseRegisters[i], SIGNAL(triggered()), this, SLOT(baseChangedSlot()));
baseRegisters[i]->setCheckable(true);
mBaseRegisters->addAction(baseRegisters[i]);
}
const char* baseRegisterNames[] = {"RAX", "BBX", "RCX", "RDX", "RBP", "RSP", "RSI", "RDI", "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15"};
#else //x86
baseRegisters[0] = new QAction("EAX", this);
baseRegisters[1] = new QAction("EBX", this);
baseRegisters[2] = new QAction("ECX", this);
baseRegisters[3] = new QAction("EDX", this);
baseRegisters[4] = new QAction("EBP", this);
baseRegisters[5] = new QAction("ESP", this);
baseRegisters[6] = new QAction("ESI", this);
baseRegisters[7] = new QAction("EDI", this);
for(char i = 0; i < 8; i++)
const char* baseRegisterNames[] = {"EAX", "EBX", "ECX", "EDX", "EBP", "ESP", "ESI", "EDI"};
#endif //_WIN64
for(unsigned int i = 0; i < _countof(baseRegisters); i++)
{
baseRegisters[i] = new QAction(baseRegisterNames[i], this);
connect(baseRegisters[i], SIGNAL(triggered()), this, SLOT(baseChangedSlot()));
baseRegisters[i]->setCheckable(true);
mBaseRegisters->addAction(baseRegisters[i]);
}
#endif //_WIN64
baseRegisters[4]->setChecked(true); //CBP
mMenu->addMenu(makeMenu(tr("Base Register")), mBaseRegisters);
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
@ -227,7 +200,7 @@ void LocalVarsView::updateSlot()
ZYDIS_REGISTER_EBP, ZYDIS_REGISTER_ESP, ZYDIS_REGISTER_ESI, ZYDIS_REGISTER_EDI
#endif //_WIN64
};
for(char j = 0; j < ArchValue(8, 16); j++)
for(unsigned int j = 0; j < _countof(registers); j++)
{
if(!baseRegisters[j]->isChecked())
continue;

View File

@ -16,13 +16,14 @@
TraceBrowser::TraceBrowser(QWidget* parent) : AbstractTableView(parent)
{
mTraceFile = nullptr;
addColumnAt(getCharWidth() * 2 * 8 + 8, "", false); //index
addColumnAt(getCharWidth() * 2 * 2 + 8, "", false); //index
addColumnAt(getCharWidth() * 2 * sizeof(dsint) + 8, "", false); //address
addColumnAt(getCharWidth() * 2 * 12 + 8, "", false); //bytes
addColumnAt(getCharWidth() * 40, "", false); //disassembly
addColumnAt(getCharWidth() * 50, "", false); //registers
addColumnAt(getCharWidth() * 50, "", false); //memory
addColumnAt(1000, "", false); //comments
loadColumnFromConfig("Trace");
setShowHeader(false); //hide header
@ -826,6 +827,7 @@ void TraceBrowser::setupRightClickContextMenu()
mBreakpointMenu->build(mMenuBuilder);
mMenuBuilder->addAction(makeShortcutAction(DIcon("label.png"), tr("Label Current Address"), SLOT(setLabelSlot()), "ActionSetLabel"), isDebugging);
mMenuBuilder->addAction(makeShortcutAction(DIcon("comment.png"), tr("&Comment"), SLOT(setCommentSlot()), "ActionSetComment"), isDebugging);
mMenuBuilder->addAction(makeShortcutAction(DIcon("bookmark_toggle.png"), tr("Toggle Bookmark"), SLOT(setBookmarkSlot()), "ActionToggleBookmark"), isDebugging);
mMenuBuilder->addAction(makeShortcutAction(DIcon("highlight.png"), tr("&Highlighting mode"), SLOT(enableHighlightingModeSlot()), "ActionHighlightingMode"), isValid);
MenuBuilder* gotoMenu = new MenuBuilder(this, isValid);
gotoMenu->addAction(makeShortcutAction(DIcon("goto.png"), tr("Expression"), SLOT(gotoSlot()), "ActionGotoExpression"), isValid);
@ -1662,6 +1664,28 @@ void TraceBrowser::setCommentSlot()
GuiUpdateAllViews();
}
void TraceBrowser::setBookmarkSlot()
{
if(!DbgIsDebugging())
return;
duint wVA = mTraceFile->Registers(getInitialSelection()).regcontext.cip;
bool result;
if(DbgGetBookmarkAt(wVA))
result = DbgSetBookmarkAt(wVA, false);
else
result = DbgSetBookmarkAt(wVA, true);
if(!result)
{
QMessageBox msg(QMessageBox::Critical, tr("Error!"), tr("DbgSetBookmarkAt failed!"));
msg.setWindowIcon(DIcon("compile-error.png"));
msg.setParent(this, Qt::Dialog);
msg.setWindowFlags(msg.windowFlags() & (~Qt::WindowContextHelpButtonHint));
msg.exec();
}
GuiUpdateAllViews();
}
void TraceBrowser::setLabelSlot()
{
if(!DbgIsDebugging() || mTraceFile == nullptr || mTraceFile->Progress() < 100)

View File

@ -159,6 +159,7 @@ public slots:
void enableHighlightingModeSlot();
void setLabelSlot();
void setCommentSlot();
void setBookmarkSlot();
void copyDisassemblySlot();
void copyCipSlot();
void copyIndexSlot();

View File

@ -320,6 +320,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "Module", 5);
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "Symbol", 5);
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "SourceView", 4);
AbstractTableView::setupColumnConfigDefaultValue(guiUint, "Trace", 7);
guiUint.insert("SIMDRegistersDisplayMode", 0);
addWindowPosConfig(guiUint, "AssembleDialog");
addWindowPosConfig(guiUint, "AttachDialog");