Restore old code for patch&relocation
This commit is contained in:
parent
606d3cec2e
commit
4cbf8ac7f1
|
@ -83,6 +83,7 @@ void Disassembly::updateColors()
|
||||||
backgroundColor = ConfigColor("DisassemblyBackgroundColor");
|
backgroundColor = ConfigColor("DisassemblyBackgroundColor");
|
||||||
|
|
||||||
mInstructionHighlightColor = ConfigColor("InstructionHighlightColor");
|
mInstructionHighlightColor = ConfigColor("InstructionHighlightColor");
|
||||||
|
mDisassemblyRelocationUnderlineColor = ConfigColor("DisassemblyRelocationUnderlineColor");
|
||||||
mSelectionColor = ConfigColor("DisassemblySelectionColor");
|
mSelectionColor = ConfigColor("DisassemblySelectionColor");
|
||||||
mCipBackgroundColor = ConfigColor("DisassemblyCipBackgroundColor");
|
mCipBackgroundColor = ConfigColor("DisassemblyCipBackgroundColor");
|
||||||
mCipColor = ConfigColor("DisassemblyCipColor");
|
mCipColor = ConfigColor("DisassemblyCipColor");
|
||||||
|
@ -452,38 +453,54 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
|
||||||
|
|
||||||
//draw bytes
|
//draw bytes
|
||||||
RichTextPainter::List richBytes;
|
RichTextPainter::List richBytes;
|
||||||
RichTextPainter::CustomRichText_t space;
|
|
||||||
space.highlightColor = ConfigColor("DisassemblyRelocationUnderlineColor");
|
|
||||||
space.highlightWidth = 1;
|
|
||||||
space.highlightConnectPrev = true;
|
|
||||||
space.flags = RichTextPainter::FlagNone;
|
|
||||||
space.text = " ";
|
|
||||||
RichTextPainter::CustomRichText_t curByte;
|
|
||||||
curByte.textColor = mBytesColor;
|
|
||||||
curByte.textBackground = mBytesBackgroundColor;
|
|
||||||
curByte.highlightColor = ConfigColor("DisassemblyRelocationUnderlineColor");
|
|
||||||
curByte.highlightWidth = 1;
|
|
||||||
curByte.flags = RichTextPainter::FlagAll;
|
|
||||||
curByte.highlight = false;
|
|
||||||
formatOpcodeString(mInstBuffer.at(rowOffset), richBytes);
|
formatOpcodeString(mInstBuffer.at(rowOffset), richBytes);
|
||||||
for(int i = 0; i < richBytes.size(); i++)
|
for(int i = 0; i < richBytes.size(); i++)
|
||||||
{
|
{
|
||||||
RichTextPainter::CustomRichText_t & curByte1 = richBytes.at(i);
|
RichTextPainter::CustomRichText_t & curByte1 = richBytes.at(i);
|
||||||
if(!DbgFunctions()->PatchGet(cur_addr + i))
|
DBGRELOCATIONINFO relocInfo;
|
||||||
|
curByte1.highlightColor = mDisassemblyRelocationUnderlineColor;
|
||||||
|
if(DbgFunctions()->ModRelocationAtAddr(cur_addr + i, &relocInfo))
|
||||||
|
{
|
||||||
|
bool prevInSameReloc = relocInfo.rva < cur_addr + i - DbgFunctions()->ModBaseFromAddr(cur_addr + i);
|
||||||
|
curByte1.highlight = true;
|
||||||
|
curByte1.highlightConnectPrev = prevInSameReloc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curByte1.highlight = false;
|
||||||
|
curByte1.highlightConnectPrev = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGPATCHINFO patchInfo;
|
||||||
|
if(DbgFunctions()->PatchGetEx(cur_addr + i, &patchInfo))
|
||||||
|
{
|
||||||
|
if(mInstBuffer.at(rowOffset).dump.at(i) == patchInfo.newbyte)
|
||||||
|
{
|
||||||
|
curByte1.textColor = mModifiedBytesColor;
|
||||||
|
curByte1.textBackground = mModifiedBytesBackgroundColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curByte1.textColor = mRestoredBytesColor;
|
||||||
|
curByte1.textBackground = mRestoredBytesBackgroundColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
curByte1.textColor = mBytesColor;
|
curByte1.textColor = mBytesColor;
|
||||||
curByte1.textBackground = mBytesBackgroundColor;
|
curByte1.textBackground = mBytesBackgroundColor;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
curByte1.textColor = mModifiedBytesColor;
|
|
||||||
curByte1.textBackground = mModifiedBytesBackgroundColor;
|
|
||||||
}
|
|
||||||
curByte1.highlight = DbgFunctions()->ModRelocationAtAddr(cur_addr + i, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(cur_addr))
|
if(mCodeFoldingManager && mCodeFoldingManager->isFolded(cur_addr))
|
||||||
{
|
{
|
||||||
|
RichTextPainter::CustomRichText_t curByte;
|
||||||
|
curByte.textColor = mBytesColor;
|
||||||
|
curByte.textBackground = mBytesBackgroundColor;
|
||||||
|
curByte.highlightColor = mDisassemblyRelocationUnderlineColor;
|
||||||
|
curByte.highlightWidth = 1;
|
||||||
|
curByte.flags = RichTextPainter::FlagAll;
|
||||||
|
curByte.highlight = false;
|
||||||
curByte.textColor = mBytesColor;
|
curByte.textColor = mBytesColor;
|
||||||
curByte.textBackground = mBytesBackgroundColor;
|
curByte.textBackground = mBytesBackgroundColor;
|
||||||
curByte.text = "...";
|
curByte.text = "...";
|
||||||
|
|
|
@ -155,6 +155,7 @@ protected:
|
||||||
// Configuration
|
// Configuration
|
||||||
QColor mInstructionHighlightColor;
|
QColor mInstructionHighlightColor;
|
||||||
QColor mSelectionColor;
|
QColor mSelectionColor;
|
||||||
|
QColor mDisassemblyRelocationUnderlineColor;
|
||||||
|
|
||||||
QColor mCipBackgroundColor;
|
QColor mCipBackgroundColor;
|
||||||
QColor mCipColor;
|
QColor mCipColor;
|
||||||
|
|
|
@ -333,7 +333,6 @@ void formatOpcodeString(const Instruction_t & inst, RichTextPainter::List & list
|
||||||
{
|
{
|
||||||
RichTextPainter::CustomRichText_t curByte;
|
RichTextPainter::CustomRichText_t curByte;
|
||||||
assert(list.empty()); //List must be empty before use
|
assert(list.empty()); //List must be empty before use
|
||||||
curByte.highlightColor = ConfigColor("DisassemblyRelocationUnderlineColor");
|
|
||||||
curByte.highlightWidth = 1;
|
curByte.highlightWidth = 1;
|
||||||
curByte.flags = RichTextPainter::FlagAll;
|
curByte.flags = RichTextPainter::FlagAll;
|
||||||
curByte.highlight = false;
|
curByte.highlight = false;
|
||||||
|
|
|
@ -1500,6 +1500,42 @@ void CPUDisassembly::pushSelectionInto(bool copyBytes, QTextStream & stream, QTe
|
||||||
{
|
{
|
||||||
RichTextPainter::List richText;
|
RichTextPainter::List richText;
|
||||||
formatOpcodeString(inst, richText);
|
formatOpcodeString(inst, richText);
|
||||||
|
for(int i = 0; i < richText.size(); i++)
|
||||||
|
{
|
||||||
|
RichTextPainter::CustomRichText_t & curByte1 = richText.at(i);
|
||||||
|
DBGRELOCATIONINFO relocInfo;
|
||||||
|
curByte1.highlightColor = mDisassemblyRelocationUnderlineColor;
|
||||||
|
if(DbgFunctions()->ModRelocationAtAddr(cur_addr + i, &relocInfo))
|
||||||
|
{
|
||||||
|
bool prevInSameReloc = relocInfo.rva < cur_addr + i - DbgFunctions()->ModBaseFromAddr(cur_addr + i);
|
||||||
|
curByte1.highlight = true;
|
||||||
|
curByte1.highlightConnectPrev = prevInSameReloc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curByte1.highlight = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGPATCHINFO patchInfo;
|
||||||
|
if(DbgFunctions()->PatchGetEx(cur_addr + i, &patchInfo))
|
||||||
|
{
|
||||||
|
if(inst.dump.at(i) == patchInfo.newbyte)
|
||||||
|
{
|
||||||
|
curByte1.textColor = mModifiedBytesColor;
|
||||||
|
curByte1.textBackground = mModifiedBytesBackgroundColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curByte1.textColor = mRestoredBytesColor;
|
||||||
|
curByte1.textBackground = mRestoredBytesBackgroundColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curByte1.textColor = mBytesColor;
|
||||||
|
curByte1.textBackground = mBytesBackgroundColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
RichTextPainter::htmlRichText(richText, bytesHtml, bytes);
|
RichTextPainter::htmlRichText(richText, bytesHtml, bytes);
|
||||||
}
|
}
|
||||||
QString disassembly;
|
QString disassembly;
|
||||||
|
|
Loading…
Reference in New Issue