-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows heap widget #2723
Draft
MalhotraPulak
wants to merge
15
commits into
dev
Choose a base branch
from
windows-heap-widget
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Windows heap widget #2723
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0de63ff
Added files for windows heap widget and made Cutter compile with new …
MalhotraPulak ee0b0f5
Add table and model for windows heap widget
MalhotraPulak 1d69dd0
Linked API calls too
MalhotraPulak a10aeac
Added more columns to block tables
MalhotraPulak 433f0c5
Fixed mem leak
MalhotraPulak bd75c45
Updated rizin
MalhotraPulak abee334
Added Dialog box for windows heaps and fixed some warnings in section…
MalhotraPulak 0380805
Fix import indentation
MalhotraPulak db977a3
Select allocator depending upon platform
MalhotraPulak dbf389c
Updated rizin
MalhotraPulak e118f91
Fixed loading of types
MalhotraPulak 5ac4eff
Remove not needed parameter `mainWindow` from windows heap widget
MalhotraPulak 430354c
Using API for loading types instead of json cmd, fixed viewing of types
MalhotraPulak 252dba9
Exporting types work now
MalhotraPulak 26c8525
Update Rizin
MalhotraPulak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include "WindowsHeapDialog.h" | ||
#include "ui_WindowsHeapDialog.h" | ||
#include <Cutter.h> | ||
#include <Configuration.h> | ||
|
||
WindowsHeapDialog::WindowsHeapDialog(QWidget *parent) | ||
: QDialog(parent), ui(new Ui::WindowsHeapDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
viewHeap = ui->tableView; | ||
viewHeap->setFont(Config()->getFont()); | ||
viewHeap->setModel(modelHeap); | ||
viewHeap->verticalHeader()->hide(); | ||
// change the scroll mode to ScrollPerPixel | ||
viewHeap->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); | ||
viewHeap->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); | ||
|
||
updateContents(); | ||
} | ||
|
||
WindowsHeapDialog::~WindowsHeapDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void WindowsHeapDialog::updateContents() | ||
{ | ||
modelHeap->reload(); | ||
viewHeap->resizeColumnsToContents(); | ||
} | ||
|
||
HeapInfoModel::HeapInfoModel(QObject *parent) : QAbstractTableModel(parent) {} | ||
|
||
QVariant HeapInfoModel::data(const QModelIndex &index, int role) const | ||
{ | ||
if (!index.isValid() || index.row() >= values.count()) | ||
return QVariant(); | ||
|
||
const auto &item = values.at(index.row()); | ||
|
||
switch (role) { | ||
case Qt::DisplayRole: | ||
switch (index.column()) { | ||
case BaseColumn: | ||
return RAddressString(item.base); | ||
case AllocatedColumn: | ||
return item.allocated; | ||
case CommittedColumn: | ||
return item.committed; | ||
case BlockCountColumn: | ||
return item.blockCount; | ||
default: | ||
return QVariant(); | ||
} | ||
default: | ||
return QVariant(); | ||
} | ||
} | ||
|
||
QVariant HeapInfoModel::headerData(int section, Qt::Orientation orientation, int role) const | ||
{ | ||
Q_UNUSED(orientation); | ||
switch (role) { | ||
case Qt::DisplayRole: | ||
switch (section) { | ||
case BaseColumn: | ||
return tr("Base Address"); | ||
case AllocatedColumn: | ||
return tr("Allocated"); | ||
case CommittedColumn: | ||
return tr("Committed"); | ||
case BlockCountColumn: | ||
return tr("Block Count"); | ||
default: | ||
return QVariant(); | ||
} | ||
default: | ||
return QVariant(); | ||
} | ||
} | ||
|
||
int HeapInfoModel::columnCount(const QModelIndex &) const | ||
{ | ||
return ColumnCount; | ||
} | ||
|
||
int HeapInfoModel::rowCount(const QModelIndex &) const | ||
{ | ||
return this->values.size(); | ||
} | ||
|
||
void HeapInfoModel::reload() | ||
{ | ||
beginResetModel(); | ||
values.clear(); | ||
values = Core()->getWindowsHeaps(); | ||
endResetModel(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going through this freezes Cutter, the call to getWindowsHeaps should be done in an AsyncTask similar to Strings/FunctionsWidget.
Also worth trying to optimize rizin's side, listing an empty heap should take 20s+.