fixing memBlock problem after join

This commit is contained in:
ghidravore 2019-08-01 17:54:31 -04:00
parent 0aa413c956
commit 8bc95794e6
2 changed files with 10 additions and 1 deletions

View file

@ -72,6 +72,7 @@ public class MemoryBlockDB implements MemoryBlock {
}
length = lRecord.getLongValue(MemoryMapDBAdapter.LENGTH_COL);
lastSubBlock = null;
Collections.sort(list);
subBlocks = list;
}

View file

@ -26,7 +26,7 @@ import ghidra.program.model.mem.*;
* Interface for the various types of memory block sections. They are used by a {@link MemoryBlockDB}
* to do the actual storing and fetching of the bytes that make up a MemoryBlock
*/
abstract class SubMemoryBlock {
abstract class SubMemoryBlock implements Comparable<SubMemoryBlock> {
protected final MemoryMapDBAdapter adapter;
protected final Record record;
@ -249,4 +249,12 @@ abstract class SubMemoryBlock {
protected abstract ByteSourceRangeList getByteSourceRangeList(MemoryBlock block, Address start,
long memBlockOffset, long size);
@Override
public int compareTo(SubMemoryBlock o) {
long result = getStartingOffset() - o.getStartingOffset();
if (result == 0) {
return 0;
}
return result > 0 ? 1 : -1;
}
}