1
0
Fork 0

Added the ability to multi-select in symbols view so you can set all breakpoints that match a search

This commit is contained in:
justin 2016-07-13 09:40:14 -06:00 committed by mrexodia
parent abc082ca3e
commit a15a126ce9
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
3 changed files with 36 additions and 17 deletions

View File

@ -197,6 +197,17 @@ int StdTable::getInitialSelection()
return mSelection.firstSelectedIndex;
}
QList<int> StdTable::getSelection()
{
QList<int> selection;
selection.reserve(mSelection.toIndex - mSelection.fromIndex);
for(int i = mSelection.fromIndex; i <= mSelection.toIndex; i++)
{
selection.append(i);
}
return selection;
}
void StdTable::selectNext()
{
int wNext = getInitialSelection() + 1;

View File

@ -24,6 +24,7 @@ public:
void expandSelectionUpTo(int to);
void setSingleSelection(int index);
int getInitialSelection();
QList<int> getSelection();
void selectNext();
void selectPrevious();
bool isSelected(int base, int offset);

View File

@ -35,6 +35,7 @@ SymbolView::SymbolView(QWidget* parent) : QWidget(parent), ui(new Ui::SymbolView
mModuleList->mSearchList->addColumnAt(charwidth * 8, tr("Party"), false);
// Setup symbol list
mSearchListView->mList->enableMultiSelection(true);
mSearchListView->mList->addColumnAt(charwidth * 2 * sizeof(dsint) + 8, tr("Address"), true);
mSearchListView->mList->addColumnAt(charwidth * 6 + 8, tr("Type"), true);
mSearchListView->mList->addColumnAt(charwidth * 80, tr("Symbol"), true);
@ -390,27 +391,33 @@ void SymbolView::toggleBreakpoint()
if(!mSearchListView->mCurList->getRowCount())
return;
QString addrText = mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 0);
duint wVA;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &wVA))
return;
if(!DbgMemIsValidReadPtr(wVA))
return;
auto selection = mSearchListView->mCurList->getSelection();
BPXTYPE wBpType = DbgGetBpxTypeAt(wVA);
QString wCmd;
if((wBpType & bp_normal) == bp_normal)
for(auto selectedIdx : selection)
{
wCmd = "bc " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
}
else
{
wCmd = "bp " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
}
QString addrText = mSearchListView->mCurList->getCellContent(selectedIdx, 0);
duint wVA;
if(!DbgFunctions()->ValFromString(addrText.toUtf8().constData(), &wVA))
return;
DbgCmdExec(wCmd.toUtf8().constData());
if(!DbgMemIsValidReadPtr(wVA))
return;
BPXTYPE wBpType = DbgGetBpxTypeAt(wVA);
QString wCmd;
if((wBpType & bp_normal) == bp_normal)
{
wCmd = "bc " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
}
else
{
wCmd = "bp " + QString("%1").arg(wVA, sizeof(dsint) * 2, 16, QChar('0')).toUpper();
}
DbgCmdExec(wCmd.toUtf8().constData());
}
}
void SymbolView::toggleBookmark()