mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 20:17:32 +08:00
Merge remote-tracking branch 'origin/GP-6449_Dan_fixMemoryViewer' into
patch (Closes #8972)
This commit is contained in:
+13
-4
@@ -52,7 +52,8 @@ public enum BasicAutoReadMemorySpec implements AutoReadMemorySpec {
|
|||||||
/**
|
/**
|
||||||
* Automatically read all visible memory
|
* Automatically read all visible memory
|
||||||
*/
|
*/
|
||||||
VISIBLE("1_READ_VISIBLE", AutoReadMemoryAction.NAME_VISIBLE, AutoReadMemoryAction.ICON_VISIBLE) {
|
VISIBLE("1_READ_VISIBLE", AutoReadMemoryAction.NAME_VISIBLE,
|
||||||
|
AutoReadMemoryAction.ICON_VISIBLE) {
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> readMemory(PluginTool tool,
|
public CompletableFuture<Boolean> readMemory(PluginTool tool,
|
||||||
DebuggerCoordinates coordinates,
|
DebuggerCoordinates coordinates,
|
||||||
@@ -77,7 +78,8 @@ public enum BasicAutoReadMemorySpec implements AutoReadMemorySpec {
|
|||||||
* Automatically read all visible memory, unless it is read-only, in which case, only read it if
|
* Automatically read all visible memory, unless it is read-only, in which case, only read it if
|
||||||
* it has not already been read.
|
* it has not already been read.
|
||||||
*/
|
*/
|
||||||
VIS_RO_ONCE("2_READ_VIS_RO_ONCE", AutoReadMemoryAction.NAME_VIS_RO_ONCE, AutoReadMemoryAction.ICON_VIS_RO_ONCE) {
|
VIS_RO_ONCE("2_READ_VIS_RO_ONCE", AutoReadMemoryAction.NAME_VIS_RO_ONCE,
|
||||||
|
AutoReadMemoryAction.ICON_VIS_RO_ONCE) {
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> readMemory(PluginTool tool,
|
public CompletableFuture<Boolean> readMemory(PluginTool tool,
|
||||||
DebuggerCoordinates coordinates,
|
DebuggerCoordinates coordinates,
|
||||||
@@ -136,8 +138,15 @@ public enum BasicAutoReadMemorySpec implements AutoReadMemorySpec {
|
|||||||
// Not terribly efficient, but this is one range most of the time
|
// Not terribly efficient, but this is one range most of the time
|
||||||
for (AddressRange range : set) {
|
for (AddressRange range : set) {
|
||||||
AddressSpace space = range.getAddressSpace();
|
AddressSpace space = range.getAddressSpace();
|
||||||
Address min = space.getAddress(range.getMinAddress().getOffset() & blockMask);
|
long minOffset = range.getMinAddress().getOffset() & blockMask;
|
||||||
Address max = space.getAddress(range.getMaxAddress().getOffset() | ~blockMask);
|
minOffset = Math.max(minOffset, space.getMinAddress().getOffset());
|
||||||
|
long maxOffset = range.getMaxAddress().getOffset() | ~blockMask;
|
||||||
|
maxOffset = Math.min(maxOffset, space.getMaxAddress().getOffset());
|
||||||
|
if (minOffset > maxOffset) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Address min = space.getAddress(minOffset);
|
||||||
|
Address max = space.getAddress(maxOffset);
|
||||||
result.add(new AddressRangeImpl(min, max));
|
result.add(new AddressRangeImpl(min, max));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+3
@@ -47,6 +47,9 @@ public class CachedBytePage {
|
|||||||
record CacheKey(DebuggerCoordinates coordinates, Address start) {
|
record CacheKey(DebuggerCoordinates coordinates, Address start) {
|
||||||
int computeOffset(DebuggerCoordinates coordinates, Address address) {
|
int computeOffset(DebuggerCoordinates coordinates, Address address) {
|
||||||
if (coordsEqualForMemory(this.coordinates, coordinates)) {
|
if (coordsEqualForMemory(this.coordinates, coordinates)) {
|
||||||
|
if (start.getAddressSpace() != address.getAddressSpace()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
long offset = address.subtract(start);
|
long offset = address.subtract(start);
|
||||||
if (0 <= offset && offset < PAGE_SIZE) {
|
if (0 <= offset && offset < PAGE_SIZE) {
|
||||||
return (int) offset;
|
return (int) offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user