Merge remote-tracking branch 'origin/master' into debugger

This commit is contained in:
Dan 2021-04-12 10:09:49 -04:00
commit 62bd317380
32 changed files with 1511 additions and 996 deletions

View file

@ -160,7 +160,7 @@ public class AddressMapImpl {
}
void checkAddressSpace(AddressSpace addrSpace) {
String name = addrSpace.getName().toUpperCase();
String name = addrSpace.getName();
AddressSpace existingSpace = spaceMap.get(name);
if (existingSpace == null) {
spaceMap.put(name, addrSpace);
@ -248,10 +248,12 @@ public class AddressMapImpl {
private void addKeyRanges(List<KeyRange> keyRangeList, Address start, Address end) {
int index = Arrays.binarySearch(sortedBaseStartAddrs, start);
if (index < 0)
if (index < 0) {
index = -index - 2;
if (index < 0)
}
if (index < 0) {
index++;
}
while (index < sortedBaseStartAddrs.length &&
end.compareTo(sortedBaseStartAddrs[index]) >= 0) {
Address addr1 = max(start, sortedBaseStartAddrs[index]);
@ -312,7 +314,7 @@ public class AddressMapImpl {
}
for (AddressSpace space : remapSpaces.values()) {
spaceMap.put(space.getName().toUpperCase(), space);
spaceMap.put(space.getName(), space);
}
for (int i = 0; i < baseAddrs.length; i++) {

View file

@ -162,7 +162,7 @@ public class StringDataInstance {
return ((AbstractStringDataType) dt).getStringDataInstance(data, data,
data.getLength());
}
if (dt instanceof Array && !data.isInitializedMemory()) {
if (dt instanceof Array && data.isInitializedMemory()) {
ArrayStringable arrayStringable =
ArrayStringable.getArrayStringable(((Array) dt).getDataType());
if (arrayStringable != null && arrayStringable.hasStringValue(data)) {
@ -918,8 +918,9 @@ public class StringDataInstance {
if (byteOffset + charSize > stringBytes.length) {
return false;
}
long origCodePointValue = DataConverter.getInstance(buf.isBigEndian()).getValue(stringBytes,
byteOffset, charSize);
long origCodePointValue = DataConverter.getInstance(buf.isBigEndian())
.getValue(stringBytes,
byteOffset, charSize);
return origCodePointValue == StringUtilities.UNICODE_REPLACEMENT;
}

View file

@ -15,7 +15,7 @@
*/
package ghidra.program.model.address;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import org.junit.*;
@ -26,6 +26,7 @@ public class AddressMapImplTest extends AbstractGenericTest {
AddressSpace sp16;
AddressSpace sp32;
AddressSpace sp64;
AddressSpace ov64;
AddressSpace regSpace;
AddressSpace stackSpace;
SegmentedAddressSpace segSpace1;
@ -42,6 +43,8 @@ public class AddressMapImplTest extends AbstractGenericTest {
sp32 = new GenericAddressSpace("THREE", 32, AddressSpace.TYPE_RAM, 2);
sp64 = new GenericAddressSpace("FOUR", 64, AddressSpace.TYPE_RAM, 2);
ov64 = new OverlayAddressSpace("four", sp64, 100, 0x1000, 0x1fff);
segSpace1 = new SegmentedAddressSpace("SegSpaceOne", 3);
segSpace2 = new SegmentedAddressSpace("SegSpaceTwo", 4);
@ -50,7 +53,7 @@ public class AddressMapImplTest extends AbstractGenericTest {
map = new AddressMapImpl();
addrs = new Address[29];
addrs = new Address[31];
addrs[0] = sp8.getAddress(0);
addrs[1] = sp8.getAddress(0x0ff);
addrs[2] = sp16.getAddress(0);
@ -84,6 +87,9 @@ public class AddressMapImplTest extends AbstractGenericTest {
addrs[27] = stackSpace.getAddress(0);
addrs[28] = stackSpace.getAddress(0x80000000);
addrs[29] = ov64.getAddress(0x1100);
addrs[30] = ov64.getAddress(0x2000);
}
@Test