mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-22 06:33:46 +00:00
Hide duplicate and cross-function edges. (#1582)
This commit is contained in:
parent
75146d63f9
commit
214e6f4264
@ -310,6 +310,7 @@ void DisassemblerGraphView::loadCurrentGraph()
|
|||||||
|
|
||||||
addBlock(gb);
|
addBlock(gb);
|
||||||
}
|
}
|
||||||
|
cleanupEdges();
|
||||||
|
|
||||||
if (!func["blocks"].toArray().isEmpty()) {
|
if (!func["blocks"].toArray().isEmpty()) {
|
||||||
computeGraph(entry);
|
computeGraph(entry);
|
||||||
@ -355,6 +356,25 @@ void DisassemblerGraphView::prepareGraphNode(GraphBlock &block)
|
|||||||
block.height = (height * charHeight) + extra;
|
block.height = (height * charHeight) + extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisassemblerGraphView::cleanupEdges()
|
||||||
|
{
|
||||||
|
for (auto &blockIt : blocks) {
|
||||||
|
auto &block = blockIt.second;
|
||||||
|
auto outIt = block.edges.begin();
|
||||||
|
std::unordered_set<ut64> seenEdges;
|
||||||
|
for (auto it = block.edges.begin(), end = block.edges.end(); it != end; ++it) {
|
||||||
|
// remove edges going to different functions
|
||||||
|
// and remove duplicate edges, common in switch statements
|
||||||
|
if (blocks.find(it->target) != blocks.end() &&
|
||||||
|
seenEdges.find(it->target) == seenEdges.end()) {
|
||||||
|
*outIt++ = *it;
|
||||||
|
seenEdges.insert(it->target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
block.edges.erase(outIt, block.edges.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DisassemblerGraphView::prepareHeader()
|
void DisassemblerGraphView::prepareHeader()
|
||||||
{
|
{
|
||||||
QString afcf = Core()->cmd("afcf").trimmed();
|
QString afcf = Core()->cmd("afcf").trimmed();
|
||||||
|
@ -158,6 +158,7 @@ private:
|
|||||||
|
|
||||||
void initFont();
|
void initFont();
|
||||||
void prepareGraphNode(GraphBlock &block);
|
void prepareGraphNode(GraphBlock &block);
|
||||||
|
void cleanupEdges();
|
||||||
void prepareHeader();
|
void prepareHeader();
|
||||||
Token *getToken(Instr *instr, int x);
|
Token *getToken(Instr *instr, int x);
|
||||||
QPoint getTextOffset(int line) const;
|
QPoint getTextOffset(int line) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user