mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Added asm.bytes options to Graph View
This commit is contained in:
parent
806fc5bded
commit
b94c5967c2
@ -27,7 +27,7 @@ public:
|
|||||||
QColor textColor;
|
QColor textColor;
|
||||||
QColor textBackground;
|
QColor textBackground;
|
||||||
CustomRichTextFlags flags;
|
CustomRichTextFlags flags;
|
||||||
bool highlight;
|
bool highlight = false;
|
||||||
QColor highlightColor;
|
QColor highlightColor;
|
||||||
int highlightWidth = 2;
|
int highlightWidth = 2;
|
||||||
bool highlightConnectPrev = false;
|
bool highlightConnectPrev = false;
|
||||||
|
@ -28,6 +28,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
|
|||||||
connect(Core(), SIGNAL(instructionChanged(RVA)), this, SLOT(refreshView()));
|
connect(Core(), SIGNAL(instructionChanged(RVA)), this, SLOT(refreshView()));
|
||||||
connect(Core(), SIGNAL(functionsChanged()), this, SLOT(refreshView()));
|
connect(Core(), SIGNAL(functionsChanged()), this, SLOT(refreshView()));
|
||||||
connect(Core(), SIGNAL(graphOptionsChanged()), this, SLOT(refreshView()));
|
connect(Core(), SIGNAL(graphOptionsChanged()), this, SLOT(refreshView()));
|
||||||
|
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(refreshView()));
|
||||||
|
|
||||||
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
|
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
|
||||||
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdatedSlot()));
|
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdatedSlot()));
|
||||||
@ -159,21 +160,45 @@ void DisassemblerGraphView::loadCurrentGraph()
|
|||||||
}
|
}
|
||||||
gb.exits.push_back(block_jump);
|
gb.exits.push_back(block_jump);
|
||||||
}
|
}
|
||||||
for (QJsonValueRef opRef : block["ops"].toArray()) {
|
for (QJsonValueRef opRef : block["ops"].toArray())
|
||||||
|
{
|
||||||
QJsonObject op = opRef.toObject();
|
QJsonObject op = opRef.toObject();
|
||||||
Instr i;
|
Instr i;
|
||||||
i.addr = op["offset"].toVariant().toULongLong();
|
i.addr = op["offset"].toVariant().toULongLong();
|
||||||
// Skip last byte, otherwise it will overlap with next instruction
|
// Skip last byte, otherwise it will overlap with next instruction
|
||||||
i.size = op["size"].toVariant().toULongLong() - 1;
|
i.size = op["size"].toVariant().toULongLong() - 1;
|
||||||
|
|
||||||
RichTextPainter::List richText;
|
RichTextPainter::List richText;
|
||||||
Colors::colorizeAssembly(richText, op["disasm"].toString(), op["type_num"].toVariant().toULongLong());
|
Colors::colorizeAssembly(richText, op["disasm"].toString(), op["type_num"].toVariant().toULongLong());
|
||||||
if (op["comment"].toString().length()) {
|
|
||||||
|
if (op["comment"].toString().length())
|
||||||
|
{
|
||||||
RichTextPainter::CustomRichText_t comment;
|
RichTextPainter::CustomRichText_t comment;
|
||||||
comment.text = QString(" ; %1").arg(QByteArray::fromBase64(op["comment"].toString().toLocal8Bit()).data());
|
comment.text = QString(" ; %1").arg(QByteArray::fromBase64(op["comment"].toString().toLocal8Bit()).data());
|
||||||
comment.textColor = mCommentColor;
|
comment.textColor = mCommentColor;
|
||||||
comment.flags = RichTextPainter::FlagColor;
|
comment.flags = RichTextPainter::FlagColor;
|
||||||
richText.insert(richText.end(), comment);
|
richText.insert(richText.end(), comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Core()->getConfigb("asm.bytes"))
|
||||||
|
{
|
||||||
|
RichTextPainter::CustomRichText_t bytes;
|
||||||
|
bytes.text = op["bytes"].toVariant().toString();
|
||||||
|
|
||||||
|
if (Core()->getConfigb("asm.bytespace"))
|
||||||
|
for (int i = 2; i <= bytes.text.size(); i += 2+1)
|
||||||
|
bytes.text.insert(i, ' ');
|
||||||
|
|
||||||
|
if (Core()->getConfigb("asm.lbytes"))
|
||||||
|
bytes.text = bytes.text.leftJustified(24, ' ');
|
||||||
|
else
|
||||||
|
bytes.text = bytes.text.rightJustified(24, ' ');
|
||||||
|
|
||||||
|
bytes.textColor = Config()->getColor("bin");
|
||||||
|
bytes.flags = RichTextPainter::FlagColor;
|
||||||
|
richText.insert(richText.begin(), bytes);
|
||||||
|
}
|
||||||
|
|
||||||
bool cropped;
|
bool cropped;
|
||||||
i.text = Text(RichTextPainter::cropped(richText, Config()->getGraphBlockMaxChars(), "...", &cropped));
|
i.text = Text(RichTextPainter::cropped(richText, Config()->getGraphBlockMaxChars(), "...", &cropped));
|
||||||
if(cropped)
|
if(cropped)
|
||||||
|
Loading…
Reference in New Issue
Block a user