1
0
Fork 0

Fix #3198: Implement GuiSelectionSet for GUI_MEMMAP

This commit is contained in:
ζeh Matt 2023-10-03 21:37:08 +03:00
parent bba369d607
commit f6c3e4219a
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
4 changed files with 47 additions and 0 deletions

View File

@ -576,6 +576,9 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_STACK:
emit selectionStackSet(selection);
break;
case GUI_MEMMAP:
emit selectionMemmapSet(selection);
break;
default:
return (void*)false;
}

View File

@ -123,6 +123,7 @@ signals:
void selectionStackSet(const SELECTIONDATA* selection);
void selectionGraphGet(SELECTIONDATA* selection);
void selectionMemmapGet(SELECTIONDATA* selection);
void selectionMemmapSet(const SELECTIONDATA* selection);
void selectionSymmodGet(SELECTIONDATA* selection);
void getStrWindow(const QString title, QString* text);
void autoCompleteAddCmd(const QString cmd);

View File

@ -37,6 +37,7 @@ MemoryMapView::MemoryMapView(StdTable* parent)
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(stateChangedSlot(DBGSTATE)));
connect(Bridge::getBridge(), SIGNAL(selectInMemoryMap(duint)), this, SLOT(selectAddress(duint)));
connect(Bridge::getBridge(), SIGNAL(selectionMemmapGet(SELECTIONDATA*)), this, SLOT(selectionGetSlot(SELECTIONDATA*)));
connect(Bridge::getBridge(), SIGNAL(selectionMemmapSet(const SELECTIONDATA*)), this, SLOT(selectionSetSlot(const SELECTIONDATA*)));
connect(Bridge::getBridge(), SIGNAL(disassembleAt(duint, duint)), this, SLOT(disassembleAtSlot(duint, duint)));
connect(Bridge::getBridge(), SIGNAL(focusMemmap()), this, SLOT(setFocus()));
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
@ -736,6 +737,47 @@ void MemoryMapView::selectionGetSlot(SELECTIONDATA* selection)
Bridge::getBridge()->setResult(BridgeResult::SelectionGet, 1);
}
void MemoryMapView::selectionSetSlot(const SELECTIONDATA* selection)
{
const auto rowCount = getRowCount();
if(rowCount == 0)
{
Bridge::getBridge()->setResult(BridgeResult::SelectionSet, 0);
return;
}
const auto badIndex = (duint) - 1;
duint firstIdx = badIndex;
duint lastIdx = badIndex;
for(duint row = 0; row < rowCount; row++)
{
const duint addrStart = getCellUserdata(row, ColAddress);
if(addrStart < selection->start)
continue;
const duint addrEnd = addrStart + getCellUserdata(row, ColSize);
if(addrEnd > selection->end)
break;
if(firstIdx == badIndex)
firstIdx = row;
lastIdx = row;
}
if(firstIdx == badIndex || lastIdx == badIndex)
{
Bridge::getBridge()->setResult(BridgeResult::SelectionSet, 0);
return;
}
setSingleSelection(firstIdx);
expandSelectionUpTo(lastIdx);
reloadData();
Bridge::getBridge()->setResult(BridgeResult::SelectionSet, 1);
}
void MemoryMapView::disassembleAtSlot(duint va, duint cip)
{
Q_UNUSED(va)

View File

@ -39,6 +39,7 @@ public slots:
void addVirtualModSlot();
void findReferencesSlot();
void selectionGetSlot(SELECTIONDATA* selection);
void selectionSetSlot(const SELECTIONDATA* selection);
void disassembleAtSlot(duint va, duint cip);
private: