-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
#3280: Selection shifts when MemoryMap is updated #3291
base: development
Are you sure you want to change the base?
Conversation
35f6ad1
to
d7f1051
Compare
✅ Download x64dbg 1.0.1837 (commit 203a6a2b29 by @foralost) |
Hm, I think it would be better to select based on the “closest” address since most likely the number of rows updates in an application with high memory pressure… I’ll take a look when I’m back home! |
Hm, Im thinking about some delta like oldAdresses - currAddress, but im wondering what if there are multiple entries which are 'equally' distant? ... or maybe something more sophisticated |
How about storing the currently-selected base+size and selecting the region that overlaps (or is just before) the previous range? |
@@ -444,6 +446,11 @@ void MemoryMapView::refreshMapSlot() | |||
setCellContent(i, ColAddress, ToPtrString((duint)mbi.BaseAddress)); | |||
setCellUserdata(i, ColAddress, (duint)mbi.BaseAddress); | |||
|
|||
if((duint)mbi.BaseAddress == currSelectedAddressRow) | |||
{ | |||
oldAddressFound = true; |
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.
I don't think it's necessary to delay setting the selection and storing the state. You can directly call setSingleSelection
here to simplify everything. Also the variable name is no longer accurate, it should be something like prevSelectedBase
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.
the reloadData
function below caused some problems with setSingleSelection
(it was jumping around like crazy)
Ok, soooooo we would be interested in selecting only the region based on selected address? *** the memory updates *** We look at the old base address -> We fetch its new base address & size -> We find the intersection (common range/addresses) -> We select now the intersected range? |
It could be something like this: void updateMemoryMap():
oldStart = getCellUserdata(firstSelectedRow, ColAddress)
oldEnd = getCellUserdata(lastSelectedRow, ColAddress) + getCellUserdata(lastSelectedRow, ColSize)
firstSelectedRow = 0, lastSelectedRow = 0
for(const region : memoryMap)
if region.base < oldStart:
firstSelectedRow++
if region.base < oldEnd:
lastSelectedRow++
setCellContent(...)
setSelection(firstSelectedRow, lastSelectedRow) Since regions (lines) in the memory map never overlap each other there will be a few possibilities:
The problem starts when multiple regions are selected, the algorithm for selecting the first region will work fine in this case but the part with Another issue will be with the sorting, in that case there isn't much we can do except find the first selected region and then just expanding the selection down with the same amount as initially. |
Ok, will try to work on it this weekend ;) |
|
Restoring the selection after the MMap is updated by holding the no. of row which was selected earlier.
brave.exe.-.PID_.14892.-.Module_.chrome_elf.dll.-.Thread_.7908.-.x64dbg.2023-12-17.11-10-38.mp4
Closes #3280 .