Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-751_ghizard_VarnodeContext_Needs_OverlayAddressSpace' (Closes #2785, Closes #2787)

ghidra179fce9b032ff
diff --cc Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/DefaultAddressFactory.java
index c9843c836e,da49972291..910c14dfa5
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/DefaultAddressFactory.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/DefaultAddressFactory.java
@@@ -18,6 -18,6 +18,7 @@@ package ghidra.program.model.address
import java.util.ArrayList;
import java.util.HashMap;
++import ghidra.program.model.lang.BasicCompilerSpec;
import ghidra.util.datastruct.IntObjectHashtable;
import ghidra.util.exception.DuplicateNameException;
@@@ -118,17 -112,38 +113,40 @@@ public class DefaultAddressFactory impl
}
private void checkReservedSpace(AddressSpace space) {
+ checkReservedVariable(space);
+ checkReservedJoin(space);
+ checkReservedExternal(space);
+ checkReservedStack(space);
+ }
+
+ private void checkReservedVariable(AddressSpace space) {
if (space.getType() == AddressSpace.TYPE_VARIABLE ||
- space.getName().equalsIgnoreCase(AddressSpace.VARIABLE_SPACE.getName()) ||
- space.getName().equals("join")) {
+ space.getName().equalsIgnoreCase(AddressSpace.VARIABLE_SPACE.getName())) {
throw new IllegalArgumentException("Variable space should not be specified");
}
+ }
+
+ private void checkReservedJoin(AddressSpace space) {
- if (space.getType() == AddressSpace.TYPE_JOIN || space.getName().equals("join")) {
++ if (space.getType() == AddressSpace.TYPE_JOIN ||
++ space.getName().equals(BasicCompilerSpec.JOIN_SPACE_NAME)) {
+ throw new IllegalArgumentException("Join space should not be specified");
+ }
+ }
+
+ private void checkReservedExternal(AddressSpace space) {
if (space.getType() == AddressSpace.TYPE_EXTERNAL ||
space.getName().equalsIgnoreCase(AddressSpace.EXTERNAL_SPACE.getName())) {
throw new IllegalArgumentException("External space should not be specified");
}
}
-
+
+ private void checkReservedStack(AddressSpace space) {
- if (space.getType() == AddressSpace.TYPE_STACK) {
++ if (space.getType() == AddressSpace.TYPE_STACK ||
++ space.getName().equalsIgnoreCase(BasicCompilerSpec.STACK_SPACE_NAME)) {
+ throw new IllegalArgumentException("Stack space should not be specified");
+ }
+ }
+
/**
* @see ghidra.program.model.address.AddressFactory#getAddress(java.lang.String)
*/
@@@ -141,6 -156,6 +159,7 @@@
}
}
catch (AddressFormatException e) {
++ // ignore
}
for (AddressSpace space : spaces) {
@@@ -155,6 -170,6 +174,7 @@@
}
}
catch (AddressFormatException e) {
++ // ignore
}
}
return null;