GUI: CPUSideBar: fixed a massive lag + added disabled breakpoint color + better color properties for jump lines (unconditional: true/false and conditional true/false)
This commit is contained in:
parent
d836493764
commit
a68e2d1e4c
|
|
@ -643,6 +643,13 @@ BRIDGE_IMPEXP bool DbgIsRunLocked()
|
|||
return false;
|
||||
}
|
||||
|
||||
BRIDGE_IMPEXP bool DbgIsBpDisabled(duint addr)
|
||||
{
|
||||
if(_dbg_sendmessage(DBG_IS_BP_DISABLED, (void*)addr, 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//GUI
|
||||
BRIDGE_IMPEXP void GuiDisasmAt(duint addr, duint cip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ enum DBGMSG
|
|||
DBG_LOOP_OVERLAPS, // param1=FUNCTION_LOOP_INFO* info, param2=unused
|
||||
DBG_LOOP_ADD, // param1=FUNCTION_LOOP_INFO* info, param2=unused
|
||||
DBG_LOOP_DEL, // param1=FUNCTION_LOOP_INFO* info, param2=unused
|
||||
DBG_IS_RUN_LOCKED // param1=unused, param2=unused
|
||||
DBG_IS_RUN_LOCKED, // param1=unused, param2=unused
|
||||
DBG_IS_BP_DISABLED // param1=duint addr, param2=unused
|
||||
};
|
||||
|
||||
enum SCRIPTLINETYPE
|
||||
|
|
@ -527,6 +528,7 @@ BRIDGE_IMPEXP bool DbgLoopOverlaps(int depth, duint start, duint end);
|
|||
BRIDGE_IMPEXP bool DbgLoopAdd(duint start, duint end);
|
||||
BRIDGE_IMPEXP bool DbgLoopDel(int depth, duint addr);
|
||||
BRIDGE_IMPEXP bool DbgIsRunLocked();
|
||||
BRIDGE_IMPEXP bool DbgIsBpDisabled(duint addr);
|
||||
|
||||
//Gui defines
|
||||
#define GUI_PLUGIN_MENU 0
|
||||
|
|
|
|||
|
|
@ -905,6 +905,16 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
|
|||
return (uint)waitislocked(WAITID_RUN);
|
||||
}
|
||||
break;
|
||||
|
||||
case DBG_IS_BP_DISABLED:
|
||||
{
|
||||
BREAKPOINT bp;
|
||||
if(bpget((uint)param1, BPNORMAL, 0, &bp))
|
||||
return !(uint)bp.enabled;
|
||||
return (uint)false;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -928,6 +928,7 @@ void AbstractTableView::setTableOffset(int_t val)
|
|||
void AbstractTableView::reloadData()
|
||||
{
|
||||
mShouldReload = true;
|
||||
emit tableOffsetChanged(mTableOffset);
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
@ -935,7 +936,6 @@ void AbstractTableView::reloadData()
|
|||
void AbstractTableView::repaint()
|
||||
{
|
||||
this->viewport()->repaint();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -343,8 +343,11 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
}
|
||||
|
||||
QList<RichTextPainter::CustomRichText_t> richText;
|
||||
BeaHighlight::PrintRtfInstruction(&richText, &mInstBuffer.at(rowOffset).disasm);
|
||||
|
||||
BeaTokenizer::BeaInstructionToken* token = &mInstBuffer[rowOffset].token;
|
||||
BeaTokenizer::TokenToRichText(token, &richText);
|
||||
RichTextPainter::paintRichText(painter, x + loopsize, y, getColumnWidth(col) - loopsize, getRowHeight(), 4, &richText, QFontMetrics(this->font()).width(QChar(' ')));
|
||||
token->x = x + loopsize;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1080,7 +1083,6 @@ void Disassembly::prepareData()
|
|||
void Disassembly::reloadData()
|
||||
{
|
||||
emit selectionChanged(rvaToVa(mSelection.firstSelectedIndex));
|
||||
emit repainted();
|
||||
AbstractTableView::reloadData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,6 @@ void AppearanceDialog::colorInfoListInit()
|
|||
colorInfoListAppend("Selection", "DisassemblySelectionColor", "");
|
||||
colorInfoListAppend("Background", "DisassemblyBackgroundColor", "");
|
||||
|
||||
|
||||
colorInfoListAppend("SideBar:", "", "");
|
||||
#ifdef _WIN64
|
||||
colorInfoListAppend("RIP Label", "SideBarCipLabelColor", "SideBarCipLabelBackgroundColor");
|
||||
|
|
@ -424,10 +423,13 @@ void AppearanceDialog::colorInfoListInit()
|
|||
#endif //_WIN64
|
||||
colorInfoListAppend("Bullets", "SideBarBulletColor", "");
|
||||
colorInfoListAppend("Breakpoints", "SideBarBulletBreakpointColor", "");
|
||||
colorInfoListAppend("Disabled Breakpoints", "SideBarBulletDisabledBreakpointColor", "");
|
||||
colorInfoListAppend("Bookmarks", "SideBarBulletBookmarkColor", "");
|
||||
colorInfoListAppend("Jump Lines (conditional jump)", "SideBarConditionalJumpLineColor", "");
|
||||
colorInfoListAppend("Jump Lines (unconditional jump)", "SideBarUnconditionalJumpLineColor", "");
|
||||
colorInfoListAppend("Jump Lines (selected jump)", "SideBarJumpLineSelectionColor", "");
|
||||
colorInfoListAppend("Conditional Jump Lines (jump)", "SideBarConditionalJumpLineTrueColor", "");
|
||||
colorInfoListAppend("Conditional Jump Lines (no jump)", "SideBarConditionalJumpLineFalseColor", "");
|
||||
colorInfoListAppend("Unconditional Jump Lines (jump)", "SideBarUnconditionalJumpLineTrueColor", "");
|
||||
colorInfoListAppend("Unconditional Jump Lines (no jump)", "SideBarUnconditionalJumpLineFalseColor", "");
|
||||
colorInfoListAppend("Jump Lines (executing)", "SideBarJumpLineExecuteColor", "");
|
||||
colorInfoListAppend("Background", "SideBarBackgroundColor", "");
|
||||
|
||||
colorInfoListAppend("Registers:", "", "");
|
||||
|
|
@ -438,7 +440,32 @@ void AppearanceDialog::colorInfoListInit()
|
|||
colorInfoListAppend("Name of Labels", "RegistersLabelColor", "");
|
||||
colorInfoListAppend("Extra Info", "RegistersExtraInfoColor", "");
|
||||
|
||||
|
||||
//dev helper
|
||||
const QMap<QString, QColor>* Colors=&Configuration::instance()->defaultColors;
|
||||
QString notFound;
|
||||
for(int i=0; i<Colors->size(); i++)
|
||||
{
|
||||
QString id=Colors->keys().at(i);
|
||||
bool bFound=false;
|
||||
for(int j=0; j<colorInfoList.size(); j++)
|
||||
{
|
||||
if(colorInfoList.at(j).colorName==id || colorInfoList.at(j).backgroundColorName==id)
|
||||
{
|
||||
bFound=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!bFound) //color not found in info list
|
||||
notFound+=id+"\n";
|
||||
}
|
||||
if(notFound.length())
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Warning, "NOT FOUND IN CONFIG!", notFound);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
|
||||
//setup context menu
|
||||
ui->listColorNames->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ void CPUDisassembly::toggleInt3BPAction()
|
|||
}
|
||||
|
||||
DbgCmdExec(wCmd.toUtf8().constData());
|
||||
emit repainted();
|
||||
emit Disassembly::repainted();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ void CPUSideBar::changeTopmostAddress(int_t i)
|
|||
if(i!=topVA)
|
||||
{
|
||||
topVA = i;
|
||||
//qDebug() << i;
|
||||
memset(®Dump, 0, sizeof(REGDUMP));
|
||||
DbgGetRegDump(®Dump);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +100,7 @@ void CPUSideBar::paintEvent(QPaintEvent *event)
|
|||
int_t instrVA = instr.rva + CodePtr->getBase();
|
||||
|
||||
// draw bullet
|
||||
drawBullets(&painter, line, DbgGetBpxTypeAt(instrVA) != bp_none, DbgGetBookmarkAt(instrVA));
|
||||
drawBullets(&painter, line, DbgGetBpxTypeAt(instrVA) != bp_none, DbgIsBpDisabled(instrVA), DbgGetBookmarkAt(instrVA));
|
||||
|
||||
if(isJump(line)) //handle jumps
|
||||
{
|
||||
|
|
@ -127,7 +128,7 @@ void CPUSideBar::paintEvent(QPaintEvent *event)
|
|||
else if(destVA <= last_va && destVA >= first_va)
|
||||
{
|
||||
int destLine = line;
|
||||
while(destLine && destLine < InstrBuffer->size() && InstrBuffer->at(destLine).rva+CodePtr->getBase() != destVA)
|
||||
while(destLine>-1 && destLine < InstrBuffer->size() && InstrBuffer->at(destLine).rva+CodePtr->getBase() != destVA)
|
||||
{
|
||||
if(destVA>instrVA) //jump goes up
|
||||
destLine++;
|
||||
|
|
@ -149,29 +150,23 @@ void CPUSideBar::paintEvent(QPaintEvent *event)
|
|||
drawLabel(&painter, line, "EIP");
|
||||
#endif
|
||||
|
||||
// read registers and add register labels
|
||||
REGDUMP z;
|
||||
memset(&z, 0, sizeof(REGDUMP));
|
||||
DbgGetRegDump(&z);
|
||||
|
||||
const int_t cur_VA = CodePtr->getBase() + InstrBuffer->at(line).rva;
|
||||
#ifdef _WIN64
|
||||
if(cur_VA == z.cax) drawLabel(&painter, line, "RAX");
|
||||
if(cur_VA == z.cbx) drawLabel(&painter, line, "RBX");
|
||||
if(cur_VA == z.ccx) drawLabel(&painter, line, "RCX");
|
||||
if(cur_VA == z.cdx) drawLabel(&painter, line, "RDX");
|
||||
if(cur_VA == z.csi) drawLabel(&painter, line, "RSI");
|
||||
if(cur_VA == z.cdi) drawLabel(&painter, line, "RDI");
|
||||
if(cur_VA == regDump.cax) drawLabel(&painter, line, "RAX");
|
||||
if(cur_VA == regDump.cbx) drawLabel(&painter, line, "RBX");
|
||||
if(cur_VA == regDump.ccx) drawLabel(&painter, line, "RCX");
|
||||
if(cur_VA == regDump.cdx) drawLabel(&painter, line, "RDX");
|
||||
if(cur_VA == regDump.csi) drawLabel(&painter, line, "RSI");
|
||||
if(cur_VA == regDump.cdi) drawLabel(&painter, line, "RDI");
|
||||
#else //x86
|
||||
if(cur_VA == z.cax) drawLabel(&painter, line, "EAX");
|
||||
if(cur_VA == z.cbx) drawLabel(&painter, line, "EBX");
|
||||
if(cur_VA == z.ccx) drawLabel(&painter, line, "ECX");
|
||||
if(cur_VA == z.cdx) drawLabel(&painter, line, "EDX");
|
||||
if(cur_VA == z.csi) drawLabel(&painter, line, "ESI");
|
||||
if(cur_VA == z.cdi) drawLabel(&painter, line, "EDI");
|
||||
if(cur_VA == regDump.cax) drawLabel(&painter, line, "EAX");
|
||||
if(cur_VA == regDump.cbx) drawLabel(&painter, line, "EBX");
|
||||
if(cur_VA == regDump.ccx) drawLabel(&painter, line, "ECX");
|
||||
if(cur_VA == regDump.cdx) drawLabel(&painter, line, "EDX");
|
||||
if(cur_VA == regDump.csi) drawLabel(&painter, line, "ESI");
|
||||
if(cur_VA == regDump.cdi) drawLabel(&painter, line, "EDI");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,16 +174,21 @@ void CPUSideBar::drawJump(QPainter* painter, int startLine,int endLine,int jumpo
|
|||
{
|
||||
painter->save();
|
||||
if(!conditional)
|
||||
painter->setPen(QPen(ConfigColor("SideBarConditionalJumpLineColor"), 1, Qt::SolidLine)); // jmp
|
||||
painter->setPen(QPen(ConfigColor("SideBarConditionalJumpLineFalseColor"), 1, Qt::SolidLine)); // jmp
|
||||
else
|
||||
painter->setPen(QPen(ConfigColor("SideBarUnconditionalJumpLineColor"), 1, Qt::DashLine));
|
||||
painter->setPen(QPen(ConfigColor("SideBarUnconditionalJumpLineFalseColor"), 1, Qt::DashLine));
|
||||
QPen tmp = painter->pen();
|
||||
|
||||
if(isactive) //selected
|
||||
{
|
||||
tmp.setWidth(2); //bold line = selected
|
||||
if(isexecute) //only highlight selected jumps
|
||||
tmp.setColor(ConfigColor("SideBarJumpLineSelectionColor"));
|
||||
tmp.setWidth(2);
|
||||
{
|
||||
if(!conditional)
|
||||
tmp.setColor(ConfigColor("SideBarConditionalJumpLineTrueColor"));
|
||||
else
|
||||
tmp.setColor(ConfigColor("SideBarUnconditionalJumpLineTrueColor"));
|
||||
}
|
||||
}
|
||||
painter->setPen(tmp);
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ void CPUSideBar::drawJump(QPainter* painter, int startLine,int endLine,int jumpo
|
|||
painter->restore();
|
||||
}
|
||||
|
||||
void CPUSideBar::drawBullets(QPainter* painter, int line, bool isbp, bool isbookmark)
|
||||
void CPUSideBar::drawBullets(QPainter* painter, int line, bool isbp, bool isbpdisabled, bool isbookmark)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
|
|
@ -311,7 +311,8 @@ void CPUSideBar::drawBullets(QPainter* painter, int line, bool isbp, bool isbook
|
|||
//painter->drawLine(0, y, viewport()->width(), y); //draw raster
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
//painter->setPen(QPen("#FFFFFF"));
|
||||
if(isbpdisabled) //disabled breakpoint
|
||||
painter->setPen(ConfigColor("SideBarBulletDisabledBreakpointColor"));
|
||||
painter->drawEllipse(x, y+yAdd, radius, radius);
|
||||
|
||||
painter->restore();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public slots:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void drawLabel(QPainter* painter, int Line, QString Text);
|
||||
void drawBullets(QPainter* painter, int line, bool ispb, bool isbookmark);
|
||||
void drawBullets(QPainter* painter, int line, bool ispb, bool isbpdisabled, bool isbookmark);
|
||||
bool isJump(int i) const;
|
||||
void drawJump(QPainter* painter, int startLine, int endLine, int jumpoffset, bool conditional, bool isexecute, bool isactive);
|
||||
|
||||
|
|
@ -40,6 +40,7 @@ private:
|
|||
CPUDisassembly *CodePtr;
|
||||
QList<Instruction_t> *InstrBuffer;
|
||||
QColor backgroundColor;
|
||||
REGDUMP regDump;
|
||||
};
|
||||
|
||||
#endif // CPUSIDEBAR_H
|
||||
|
|
|
|||
|
|
@ -54,12 +54,13 @@ void Configuration::readColors()
|
|||
defaultColorMap.insert("SideBarCipLabelColor", QColor("#FFFFFF"));
|
||||
defaultColorMap.insert("SideBarCipLabelBackgroundColor", QColor("#4040FF"));
|
||||
defaultColorMap.insert("SideBarBackgroundColor", QColor("#FFFBF0"));
|
||||
defaultColorMap.insert("SideBarJumpLineSelectionColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("SideBarUnconditionalJumpLineColor", QColor("#808080"));
|
||||
defaultColorMap.insert("SideBarConditionalJumpLineColor", QColor("#808080"));
|
||||
defaultColorMap.insert("SideBarConditionalJumpLineTrueColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("SideBarConditionalJumpLineFalseColor", QColor("#808080"));
|
||||
defaultColorMap.insert("SideBarUnconditionalJumpLineTrueColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("SideBarUnconditionalJumpLineFalseColor", QColor("#808080"));
|
||||
defaultColorMap.insert("SideBarBulletColor", QColor("#808080"));
|
||||
defaultColorMap.insert("SideBarBulletBreakpointColor", QColor("#FF0000"));
|
||||
// TODO: defaultColorMap.insert("SideBarBulletBreakpointDisabledColor", QColor("#0F610F"));
|
||||
defaultColorMap.insert("SideBarBulletDisabledBreakpointColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("SideBarBulletBookmarkColor", QColor("#FEE970"));
|
||||
|
||||
defaultColorMap.insert("RegistersBackgroundColor", QColor("#FFFBF0"));
|
||||
|
|
@ -69,10 +70,6 @@ void Configuration::readColors()
|
|||
defaultColorMap.insert("RegistersLabelColor", QColor("#000000"));
|
||||
defaultColorMap.insert("RegistersExtraInfoColor", QColor("#000000"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Colors = defaultColors = defaultColorMap;
|
||||
//read config
|
||||
for(int i=0; i<Colors.size(); i++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue