1
0
Fork 0

GUI: fix bug in the graph view where debugge exit doesnt clear the state

This commit is contained in:
Duncan Ogilvie 2020-01-08 01:34:02 +01:00
parent b4a03a8009
commit dcc77c5071
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 36 additions and 14 deletions

View File

@ -33,19 +33,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget* parent)
this->status = "Loading...";
//Start disassembly view at the entry point of the binary
this->function = 0;
this->ready = false;
this->viewportReady = false;
this->desired_pos = nullptr;
this->highlight_token = nullptr;
this->cur_instr = 0;
this->scroll_base_x = 0;
this->scroll_base_y = 0;
this->scroll_mode = false;
this->drawOverview = false;
this->onlySummary = false;
this->blocks.clear();
this->saveGraph = false;
resetGraph();
//Initialize zoom values
this->graphZoomMode = ConfigBool("Gui", "GraphZoomMode");
@ -86,6 +74,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget* parent)
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));
connect(Bridge::getBridge(), SIGNAL(focusGraph()), this, SLOT(setFocus()));
connect(Bridge::getBridge(), SIGNAL(getCurrentGraph(BridgeCFGraphList*)), this, SLOT(getCurrentGraphSlot(BridgeCFGraphList*)));
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(dbgStateChangedSlot(DBGSTATE)));
//Connect to config
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
@ -101,6 +90,29 @@ DisassemblerGraphView::~DisassemblerGraphView()
delete this->highlight_token;
}
void DisassemblerGraphView::resetGraph()
{
this->function = 0;
this->ready = false;
this->viewportReady = false;
this->desired_pos = nullptr;
this->highlight_token = nullptr;
this->cur_instr = 0;
this->scroll_base_x = 0;
this->scroll_base_y = 0;
this->scroll_mode = false;
this->drawOverview = false;
this->onlySummary = false;
this->blocks.clear();
this->saveGraph = false;
this->analysis = Analysis();
this->currentGraph = BridgeCFGraph(0);
this->currentBlockMap.clear();
this->syncOrigin = false;
}
void DisassemblerGraphView::initFont()
{
setFont(ConfigFont("Disassembly"));
@ -2522,7 +2534,6 @@ restart:
void DisassemblerGraphView::xrefSlot()
{
if(!DbgIsDebugging())
return;
duint wVA = this->get_cursor_pos();
@ -2586,3 +2597,12 @@ void DisassemblerGraphView::getCurrentGraphSlot(BridgeCFGraphList* graphList)
*graphList = currentGraph.ToGraphList();
Bridge::getBridge()->setResult(BridgeResult::GraphCurrent);
}
void DisassemblerGraphView::dbgStateChangedSlot(DBGSTATE state)
{
if(state == stopped)
{
resetGraph();
this->viewport()->update();
}
}

View File

@ -208,6 +208,7 @@ public:
DisassemblerGraphView(QWidget* parent = nullptr);
~DisassemblerGraphView();
void resetGraph();
void initFont();
void adjustSize(int viewportWidth, int viewportHeight, QPoint mousePosition = QPoint(0, 0), bool fitToWindow = false);
void resizeEvent(QResizeEvent* event);
@ -285,6 +286,7 @@ public slots:
void fitToWindowSlot();
void zoomToCursorSlot();
void getCurrentGraphSlot(BridgeCFGraphList* graphList);
void dbgStateChangedSlot(DBGSTATE state);
private:
bool graphZoomMode;