mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 01:39:21 +02:00
Merge remote-tracking branch 'origin/GP-5990_ghidra1_ListingCompositeMapRemoval' into Ghidra_12.0
This commit is contained in:
commit
8d066797c9
12 changed files with 52 additions and 435 deletions
|
@ -134,8 +134,8 @@ public class DBTraceDefinedDataView extends AbstractBaseDBTraceDefinedUnitsView<
|
|||
|
||||
// Truncate, then check that against existing code units.
|
||||
long endSnap = computeTruncatedMax(lifespan, null, createdRange);
|
||||
TraceAddressSnapRange tasr = new ImmutableTraceAddressSnapRange(createdRange,
|
||||
Lifespan.span(startSnap, endSnap));
|
||||
TraceAddressSnapRange tasr =
|
||||
new ImmutableTraceAddressSnapRange(createdRange, Lifespan.span(startSnap, endSnap));
|
||||
if (!space.undefinedData.coversRange(tasr)) {
|
||||
// TODO: Figure out the conflicting unit?
|
||||
throw new CodeUnitInsertionException("Code units cannot overlap");
|
||||
|
@ -170,26 +170,4 @@ public class DBTraceDefinedDataView extends AbstractBaseDBTraceDefinedUnitsView<
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unitRemoved(DBTraceData unit) {
|
||||
super.unitRemoved(unit);
|
||||
DataType dataType = unit.getBaseDataType();
|
||||
if (dataType instanceof Composite || dataType instanceof Array ||
|
||||
dataType instanceof Dynamic) {
|
||||
space.trace.setChanged(new TraceChangeRecord<>(TraceEvents.COMPOSITE_DATA_REMOVED,
|
||||
space.space, unit.getBounds(), unit, null));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void unitSpanChanged(Lifespan oldSpan, DBTraceData unit) {
|
||||
super.unitSpanChanged(oldSpan, unit);
|
||||
DataType dataType = unit.getBaseDataType();
|
||||
if (dataType instanceof Composite || dataType instanceof Array ||
|
||||
dataType instanceof Dynamic) {
|
||||
space.trace.setChanged(
|
||||
new TraceChangeRecord<>(TraceEvents.COMPOSITE_DATA_LIFESPAN_CHANGED,
|
||||
space.space, unit, oldSpan, unit.getLifespan()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.util.*;
|
|||
|
||||
import org.apache.commons.collections4.IteratorUtils;
|
||||
|
||||
import generic.util.MergeSortingIterator;
|
||||
import generic.util.FlattenedIterator;
|
||||
import generic.util.MergeSortingIterator;
|
||||
import ghidra.program.database.ProgramDB;
|
||||
import ghidra.program.database.code.InstructionDB;
|
||||
import ghidra.program.database.function.OverlappingFunctionException;
|
||||
|
@ -688,24 +688,6 @@ public abstract class AbstractDBTraceProgramViewListing implements TraceProgramV
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(boolean forward) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(Address start, boolean forward) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(AddressSetView addrSet, boolean forward) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getUserDefinedProperties() {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
@ -115,10 +115,6 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
listenFor(TraceEvents.PRE_COMMENT_CHANGED, this::commentPreChanged);
|
||||
listenFor(TraceEvents.REPEATABLE_COMMENT_CHANGED, this::commentRepeatableChanged);
|
||||
|
||||
listenFor(TraceEvents.COMPOSITE_DATA_ADDED, this::compositeDataAdded);
|
||||
listenFor(TraceEvents.COMPOSITE_DATA_LIFESPAN_CHANGED, this::compositeLifespanChanged);
|
||||
listenFor(TraceEvents.COMPOSITE_DATA_REMOVED, this::compositeDataRemoved);
|
||||
|
||||
listenFor(TraceEvents.DATA_TYPE_ADDED, this::dataTypeAdded);
|
||||
listenFor(TraceEvents.DATA_TYPE_CHANGED, this::dataTypeChanged);
|
||||
listenFor(TraceEvents.DATA_TYPE_REPLACED, this::dataTypeReplaced);
|
||||
|
@ -322,8 +318,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
range.getX2(), null, null, null));
|
||||
}
|
||||
|
||||
private void codeDataTypeSettingsChanged(AddressSpace space,
|
||||
TraceAddressSnapRange range) {
|
||||
private void codeDataTypeSettingsChanged(AddressSpace space, TraceAddressSnapRange range) {
|
||||
DomainObjectEventQueues queues = isVisible(space, range);
|
||||
if (queues == null) {
|
||||
return;
|
||||
|
@ -369,45 +364,6 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
commentChanged(CommentType.REPEATABLE, space, range, oldValue, newValue);
|
||||
}
|
||||
|
||||
private void compositeDataAdded(AddressSpace space, TraceAddressSnapRange range,
|
||||
TraceData oldIsNull, TraceData added) {
|
||||
DomainObjectEventQueues queues = isCodeVisible(space, added);
|
||||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_ADDED,
|
||||
added.getMinAddress(), added.getMaxAddress(), null, null, added));
|
||||
}
|
||||
|
||||
private void compositeLifespanChanged(AddressSpace space, TraceData data, Lifespan oldSpan,
|
||||
Lifespan newSpan) {
|
||||
DomainObjectEventQueues queues = getEventQueues(space);
|
||||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
boolean inOld = isCodeVisible(data, oldSpan);
|
||||
boolean inNew = isCodeVisible(data, newSpan);
|
||||
if (inOld && !inNew) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_REMOVED,
|
||||
data.getMinAddress(), data.getMaxAddress(), null, data, null));
|
||||
}
|
||||
if (!inOld && inNew) {
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_ADDED,
|
||||
data.getMinAddress(), data.getMaxAddress(), null, null, data));
|
||||
}
|
||||
}
|
||||
|
||||
private void compositeDataRemoved(AddressSpace space, TraceAddressSnapRange range,
|
||||
TraceData removed, TraceData newIsNull) {
|
||||
DomainObjectEventQueues queues = isCodeVisible(space, removed);
|
||||
if (queues == null) {
|
||||
return;
|
||||
}
|
||||
// TODO: ProgramDB doesn't send this.... Should I?
|
||||
queues.fireEvent(new ProgramChangeRecord(ProgramEvent.COMPOSITE_REMOVED,
|
||||
removed.getMinAddress(), removed.getMaxAddress(), null, removed, null));
|
||||
}
|
||||
|
||||
private void dataTypeAdded(long id, DataType oldIsNull, DataType added) {
|
||||
fireEventAllViews(new ProgramChangeRecord(ProgramEvent.DATA_TYPE_ADDED, null, null,
|
||||
null, oldIsNull, added));
|
||||
|
@ -452,8 +408,8 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
instruction.getMinAddress(), instruction.getMinAddress(), null, null, null));
|
||||
}
|
||||
|
||||
private void instructionFallThroughChanged(AddressSpace space,
|
||||
TraceInstruction instruction, boolean oldFallThrough, boolean newFallThrough) {
|
||||
private void instructionFallThroughChanged(AddressSpace space, TraceInstruction instruction,
|
||||
boolean oldFallThrough, boolean newFallThrough) {
|
||||
DomainObjectEventQueues queues = isCodeVisible(space, instruction);
|
||||
if (queues == null) {
|
||||
return;
|
||||
|
@ -1460,8 +1416,7 @@ public class DBTraceProgramView implements TraceProgramView {
|
|||
return eventQueues;
|
||||
}
|
||||
|
||||
protected DomainObjectEventQueues isVisible(AddressSpace space,
|
||||
TraceAddressSnapRange range) {
|
||||
protected DomainObjectEventQueues isVisible(AddressSpace space, TraceAddressSnapRange range) {
|
||||
return viewport.containsAnyUpper(range.getLifespan()) ? getEventQueues(space) : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ import ghidra.program.model.address.Address;
|
|||
import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.LanguageID;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.exception.RollbackException;
|
||||
|
@ -44,7 +45,9 @@ import ghidra.util.exception.RollbackException;
|
|||
@Category(NightlyCategory.class)
|
||||
public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
private static final String COMPOSITE_DATA_ADDRESS = "00400050";
|
||||
private static final int ARRAY_ELEMENT_COUNT = 6;
|
||||
private static final String ARRAY_DATA_ADDRESS = "00400050";
|
||||
|
||||
private static final String DATA_STRING_ADDRESS = "0041fee4";
|
||||
private static final String BYTE_SCALAR_ADDRESS = "00421eb0";
|
||||
private static final String CHAR_SCALAR_ADDRESS = "00421ed0";
|
||||
|
@ -98,7 +101,7 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
int txId = program.startTransaction("Test");
|
||||
try {
|
||||
createCompositeDataType();
|
||||
createArrayDataType();
|
||||
createByteDataType();
|
||||
createCharDataType();
|
||||
createDWordDataType();
|
||||
|
@ -212,9 +215,9 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCompositeDataInTable() throws Exception {
|
||||
public void testArrayDataInTable() throws Exception {
|
||||
searchProgramAndDisplayResults(program, null, minScalarVal, maxScalarVal);
|
||||
assertScalarsFromCompositeDataInTable();
|
||||
assertScalarsFromArrayDataInTable();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -417,25 +420,18 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertEquals(0, data.size());
|
||||
}
|
||||
|
||||
private void assertScalarsFromCompositeDataInTable() {
|
||||
private void assertScalarsFromArrayDataInTable() {
|
||||
|
||||
Listing listing = program.getListing();
|
||||
DataIterator compositeData = listing.getCompositeData(true);
|
||||
Data composite = compositeData.next();
|
||||
assertTrue("Expected array; found: " + composite, composite.getDataType() instanceof Array);
|
||||
|
||||
//@formatter:off
|
||||
List<ScalarRowObject> data = getTableData();
|
||||
List<Address> addresses =
|
||||
data.stream()
|
||||
.map(rowObject -> rowObject.getAddress())
|
||||
.collect(Collectors.toList())
|
||||
;
|
||||
//@formatter:on
|
||||
List<Address> addresses = data.stream().map(rowObject -> rowObject.getAddress()).toList();
|
||||
|
||||
int n = composite.getNumComponents();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Data child = composite.getComponent(i);
|
||||
Address arrayAddr = program.getAddressFactory().getAddress(ARRAY_DATA_ADDRESS);
|
||||
Data arrayData = program.getListing().getDefinedDataAt(arrayAddr);
|
||||
assertNotNull(arrayData);
|
||||
assertEquals("byte[6]", arrayData.getDataType().getName());
|
||||
|
||||
for (int i = 0; i < ARRAY_ELEMENT_COUNT; i++) {
|
||||
Data child = arrayData.getComponent(i);
|
||||
Address a = child.getAddress();
|
||||
assertTrue(addresses.contains(a));
|
||||
}
|
||||
|
@ -497,18 +493,12 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
tableAddress.add(rowObject.getAddress());
|
||||
}
|
||||
|
||||
DataIterator compositeData = p.getListing().getCompositeData(true);
|
||||
Address structAddr = p.getAddressFactory().getAddress(NESTED_STRUCTURE_DATA_ADDRESS);
|
||||
Data compositeData = p.getListing().getDefinedDataAt(structAddr);
|
||||
assertEquals("NESTED_STRUCTURE", compositeData.getDataType().getName());
|
||||
|
||||
while (compositeData.hasNext()) {
|
||||
|
||||
Data structureData = compositeData.next();
|
||||
Address address = structureData.getComponent(0).getAddress();
|
||||
|
||||
if (!tableAddress.contains(address)) {
|
||||
fail("Table not created correctly: could not find address " + address +
|
||||
"in scalar table.");
|
||||
}
|
||||
}
|
||||
assertTrue("Table not created correctly: could not find address " + structAddr +
|
||||
"in scalar table.", tableAddress.contains(structAddr));
|
||||
}
|
||||
|
||||
private void setFilterValues(int min, int max) {
|
||||
|
@ -555,15 +545,14 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
"A_virt2@401120", 16);
|
||||
createFunction(builder, "00401130", "55 8b ec 51 89 4d fc b8 08 00 00 00 8b e5 5d c3",
|
||||
"B_virt2@401130", 16);
|
||||
createFunction(builder, "00401140", "48 83 ec cc",
|
||||
"C_virt2@401140", 4);
|
||||
createFunction(builder, "00401140", "48 83 ec cc", "C_virt2@401140", 4);
|
||||
createFunction(builder, "00401150", "55 8b ec 51 89 4d fc b8 cc 00 00 00 8b e5 5d c3",
|
||||
"C_virt2@401150", 16);
|
||||
|
||||
createBytes(builder, COMPOSITE_DATA_ADDRESS,
|
||||
"0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68 69 73 20 70 " +
|
||||
"72 6f 67 72 61 6d 20 63 61 6e 6e 6f 74 20 62 65 20 72 75 6e " +
|
||||
"20 69 6e 20 44 4f 53 20 6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 " + "00 00 00 00");
|
||||
createBytes(builder, ARRAY_DATA_ADDRESS,
|
||||
"0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68 69 73 20 70 72 6f 67 72 61 6d 20 63 " +
|
||||
"61 6e 6e 6f 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20 6d 6f 64 65 2e 0d " +
|
||||
"0d 0a 24 00 00 00 00 00 00 00");
|
||||
createBytes(builder, BYTE_SCALAR_ADDRESS, "c4");
|
||||
createBytes(builder, CHAR_SCALAR_ADDRESS, "28");
|
||||
createBytes(builder, DWORD_SCALAR_ADDRESS, "08 34 23 cd");
|
||||
|
@ -686,9 +675,9 @@ public class ScalarSearchTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
private void createCompositeDataType() throws Exception {
|
||||
private void createArrayDataType() throws Exception {
|
||||
ArrayDataType arrayDataType = new ArrayDataType(new ByteDataType(), 6, 2);
|
||||
createData(addr(Long.parseLong(COMPOSITE_DATA_ADDRESS, 16)), arrayDataType);
|
||||
createData(addr(Long.parseLong(ARRAY_DATA_ADDRESS, 16)), arrayDataType);
|
||||
}
|
||||
|
||||
private void createByteDataType() throws Exception {
|
||||
|
|
|
@ -1239,169 +1239,6 @@ public class CodeUnitIteratorTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
dtm.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCompositeData() throws Exception {
|
||||
startTransaction();
|
||||
mem.createInitializedBlock("test", addr(0), 1000, (byte) 0, TaskMonitor.DUMMY, false);
|
||||
|
||||
Structure struct = new StructureDataType("struct_1", 100);
|
||||
Structure struct2 = new StructureDataType("struct_2", 0);
|
||||
Structure struct3 = new StructureDataType("struct_3", 0);
|
||||
DataTypeManager dtm = new StandAloneDataTypeManager("dummyDTM");
|
||||
int id = dtm.startTransaction("");
|
||||
|
||||
struct = (Structure) dtm.resolve(struct, null);
|
||||
struct2 = (Structure) dtm.resolve(struct2, null);
|
||||
struct3 = (Structure) dtm.resolve(struct3, null);
|
||||
|
||||
struct2.add(new ByteDataType());
|
||||
struct2.add(new StringDataType(), 20);
|
||||
struct2.add(new QWordDataType());
|
||||
struct3.add(struct2);
|
||||
|
||||
struct.replace(0, struct2, struct2.getLength());
|
||||
struct.replace(1, new StringDataType(), 10);
|
||||
|
||||
listing.createData(addr(0), struct, 0);
|
||||
|
||||
listing.createData(addr(300), struct2, 0);
|
||||
|
||||
listing.createData(addr(250), struct3, 0);
|
||||
endTransaction();
|
||||
|
||||
DataIterator iter = listing.getCompositeData(true);
|
||||
assertTrue(iter.hasNext());
|
||||
Data d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(0), d.getMinAddress());
|
||||
assertEquals(addr(99), d.getMaxAddress());
|
||||
|
||||
d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(250), d.getMinAddress());
|
||||
assertEquals("struct_3", d.getDataType().getName());
|
||||
|
||||
d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(300), d.getMinAddress());
|
||||
assertEquals(3, d.getNumComponents());
|
||||
|
||||
assertTrue(!iter.hasNext());
|
||||
d = iter.next();
|
||||
assertNull(d);
|
||||
dtm.endTransaction(id, true);
|
||||
dtm.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCompositeDataStartingAt() throws Exception {
|
||||
startTransaction();
|
||||
mem.createInitializedBlock("test", addr(0), 1000, (byte) 0, TaskMonitor.DUMMY, false);
|
||||
|
||||
Structure struct = new StructureDataType("struct_1", 100);
|
||||
Structure struct2 = new StructureDataType("struct_2", 0);
|
||||
Structure struct3 = new StructureDataType("struct_3", 0);
|
||||
DataTypeManager dtm = new StandAloneDataTypeManager("dummyDTM");
|
||||
int id = dtm.startTransaction("");
|
||||
struct = (Structure) dtm.resolve(struct, null);
|
||||
struct2 = (Structure) dtm.resolve(struct2, null);
|
||||
struct3 = (Structure) dtm.resolve(struct3, null);
|
||||
|
||||
struct2.add(new ByteDataType());
|
||||
struct2.add(new StringDataType(), 20);
|
||||
struct2.add(new QWordDataType());
|
||||
struct3.add(struct2);
|
||||
|
||||
struct.replace(0, struct2, struct2.getLength());
|
||||
struct.replace(1, new StringDataType(), 10);
|
||||
|
||||
listing.createData(addr(0), struct, 0);
|
||||
|
||||
listing.createData(addr(300), struct2, 0);
|
||||
|
||||
listing.createData(addr(250), struct3, 0);
|
||||
|
||||
Union union = new UnionDataType("union_1");
|
||||
union.add(struct3);
|
||||
union.add(struct2);
|
||||
|
||||
listing.createData(addr(600), union, 0);
|
||||
endTransaction();
|
||||
|
||||
DataIterator iter = listing.getCompositeData(addr(275), true);
|
||||
assertTrue(iter.hasNext());
|
||||
|
||||
Data d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(300), d.getMinAddress());
|
||||
|
||||
d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(600), d.getMinAddress());
|
||||
|
||||
assertTrue(!iter.hasNext());
|
||||
assertNull(iter.next());
|
||||
dtm.endTransaction(id, true);
|
||||
dtm.close();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCompositeDataInSet() throws Exception {
|
||||
startTransaction();
|
||||
mem.createInitializedBlock("test", addr(0), 1000, (byte) 0, TaskMonitor.DUMMY, false);
|
||||
|
||||
Structure struct = new StructureDataType("struct_1", 100);
|
||||
Structure struct2 = new StructureDataType("struct_2", 0);
|
||||
Structure struct3 = new StructureDataType("struct_3", 0);
|
||||
DataTypeManager dtm = new StandAloneDataTypeManager("dummyDTM");
|
||||
int id = dtm.startTransaction("");
|
||||
struct = (Structure) dtm.resolve(struct, null);
|
||||
struct2 = (Structure) dtm.resolve(struct2, null);
|
||||
struct3 = (Structure) dtm.resolve(struct3, null);
|
||||
|
||||
struct2.add(new ByteDataType());
|
||||
struct2.add(new StringDataType(), 20);
|
||||
struct2.add(new QWordDataType());
|
||||
struct3.add(struct2);
|
||||
|
||||
struct.replace(0, struct2, struct2.getLength());
|
||||
struct.replace(1, new StringDataType(), 10);
|
||||
|
||||
listing.createData(addr(0), struct, 0);
|
||||
|
||||
listing.createData(addr(300), struct2, 0);
|
||||
|
||||
listing.createData(addr(450), struct3, 0);
|
||||
|
||||
Union union = new UnionDataType("union_1");
|
||||
union.add(struct3);
|
||||
union.add(struct2);
|
||||
|
||||
listing.createData(addr(800), union, 0);
|
||||
endTransaction();
|
||||
|
||||
AddressSet set = new AddressSet();
|
||||
set.addRange(addr(5), addr(10));
|
||||
set.addRange(addr(100), addr(200));
|
||||
set.addRange(addr(300), addr(320));
|
||||
set.addRange(addr(400), addr(500));
|
||||
|
||||
DataIterator iter = listing.getCompositeData(set, true);
|
||||
Data d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(300), d.getMinAddress());
|
||||
d = iter.next();
|
||||
assertNotNull(d);
|
||||
assertEquals(addr(450), d.getMinAddress());
|
||||
|
||||
d = iter.next();
|
||||
assertNull(d);
|
||||
dtm.endTransaction(id, true);
|
||||
dtm.close();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDefinedDataIterator() throws Exception {
|
||||
startTransaction();
|
||||
|
|
|
@ -235,22 +235,6 @@ class ListingDB implements Listing {
|
|||
return codeMgr.getFirstUndefinedDataBefore(addr, monitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(boolean forward) {
|
||||
return codeMgr.getCompositeData(forward ? program.getMinAddress() : program.getMaxAddress(),
|
||||
forward);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(Address start, boolean forward) {
|
||||
return codeMgr.getCompositeData(start, forward);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(AddressSetView addrSet, boolean forward) {
|
||||
return codeMgr.getCompositeData(addrSet, forward);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getUserDefinedProperties() {
|
||||
return codeMgr.getUserDefinedProperties();
|
||||
|
|
|
@ -115,8 +115,9 @@ public class ProgramDB extends DomainObjectAdapterDB implements Program, ChangeM
|
|||
* Multiple blocks are permitted within a single overlay space.
|
||||
* 13-Dec-2024 - version 29 Added source file manager.
|
||||
* 3-Jun-2025 - version 30 Symbol Table schema V4 with external symbol data indexing
|
||||
* 15-Sep-2025 - version 31 Code Mananger dropped Composites property map use
|
||||
*/
|
||||
static final int DB_VERSION = 30;
|
||||
static final int DB_VERSION = 31;
|
||||
|
||||
/**
|
||||
* UPGRADE_REQUIRED_BFORE_VERSION should be changed to DB_VERSION anytime the
|
||||
|
|
|
@ -64,7 +64,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
private ProgramContext contextMgr;
|
||||
private ReferenceManager refManager;
|
||||
private PropertyMapManager propertyMapMgr;
|
||||
private VoidPropertyMapDB compositeMgr;
|
||||
private IntPropertyMapDB lengthMgr;
|
||||
|
||||
private boolean contextLockingEnabled = false;
|
||||
|
@ -97,8 +96,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
|
||||
cache = new DBObjectCache<>(1000);
|
||||
protoMgr = new PrototypeManager(handle, addrMap, openMode, monitor);
|
||||
compositeMgr =
|
||||
new VoidPropertyMapDB(dbHandle, openMode, this, null, addrMap, "Composites", monitor);
|
||||
lengthMgr =
|
||||
new IntPropertyMapDB(dbHandle, openMode, this, null, addrMap, "Lengths", monitor);
|
||||
|
||||
|
@ -131,6 +128,15 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
}
|
||||
}
|
||||
|
||||
private void removeOldCompositeMap() throws IOException {
|
||||
// Remove old Composites Void property map associated with tracking composite
|
||||
// placement in memory. This tracking mechanism was never used.
|
||||
String oldTableName = "Property Map - Composites";
|
||||
if (dbHandle.getTable(oldTableName) != null) {
|
||||
dbHandle.deleteTable(oldTableName);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert old fall-through overrides into References.
|
||||
*/
|
||||
|
@ -235,6 +241,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
throws IOException, CancelledException {
|
||||
if (openMode == OpenMode.UPGRADE) {
|
||||
upgradeOldFallThroughMaps(monitor);
|
||||
removeOldCompositeMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,7 +758,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
lock.acquire();
|
||||
boolean success = false;
|
||||
try {
|
||||
compositeMgr.removeRange(start, end);
|
||||
monitor.checkCancelled();
|
||||
instAdapter.deleteRecords(start, end);
|
||||
monitor.checkCancelled();
|
||||
|
@ -2061,12 +2067,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
data = getDataDB(record);
|
||||
baseDt = data.getBaseDataType();
|
||||
|
||||
if (dataType instanceof Composite || dataType instanceof Array ||
|
||||
dataType instanceof Dynamic) {
|
||||
compositeMgr.add(addr);
|
||||
program.setChanged(ProgramEvent.COMPOSITE_ADDED, addr, endAddr, null, null);
|
||||
}
|
||||
|
||||
// fire event
|
||||
program.setChanged(ProgramEvent.CODE_ADDED, addr, endAddr, null, data);
|
||||
|
||||
|
@ -2399,43 +2399,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a composite data iterator beginning at the specified start address.
|
||||
*
|
||||
* @param start the address to begin iterator
|
||||
* @param forward true means get iterator in forward direction
|
||||
* @return the composite data iterator
|
||||
*/
|
||||
public DataIterator getCompositeData(Address start, boolean forward) {
|
||||
try {
|
||||
return new DataKeyIterator(this, addrMap,
|
||||
compositeMgr.getAddressKeyIterator(start, forward));
|
||||
}
|
||||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a composite data iterator limited to the addresses in the specified address set.
|
||||
*
|
||||
* @param addrSet the address set to limit the iterator
|
||||
* @param forward determines if the iterator will go from the lowest address to the highest or
|
||||
* the other way around.
|
||||
* @return DataIterator the composite data iterator
|
||||
*/
|
||||
public DataIterator getCompositeData(AddressSetView addrSet, boolean forward) {
|
||||
try {
|
||||
return new DataKeyIterator(this, addrMap,
|
||||
compositeMgr.getAddressKeyIterator(addrSet, forward));
|
||||
}
|
||||
catch (IOException e) {
|
||||
program.dbError(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over all codeUnits in the program from the given start address to either
|
||||
* the end address or the start address, depending if the iterator is forward or not.
|
||||
|
@ -2856,7 +2819,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
try {
|
||||
Address endAddr = startAddr.add(length - 1);
|
||||
|
||||
compositeMgr.moveRange(startAddr, endAddr, newStartAddr);
|
||||
monitor.checkCancelled();
|
||||
|
||||
lengthMgr.moveRange(startAddr, endAddr, newStartAddr);
|
||||
|
@ -3205,7 +3167,6 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
try {
|
||||
cache.invalidate();
|
||||
lengthMgr.invalidate();
|
||||
compositeMgr.invalidate();
|
||||
protoMgr.clearCache();
|
||||
}
|
||||
finally {
|
||||
|
@ -3227,12 +3188,7 @@ public class CodeManager implements ErrorHandler, ManagerDB {
|
|||
*/
|
||||
public void memoryChanged(Address addr, Address end) {
|
||||
lock.acquire();
|
||||
// CodeUnit cu = getCodeUnitContaining(addr);
|
||||
// if (cu != null) {
|
||||
// addr = cu.getMinAddress();
|
||||
// }
|
||||
try {
|
||||
// cache.invalidate(addrMap.getKey(addr), addrMap.getKey(end));
|
||||
cache.invalidate();
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -604,39 +604,6 @@ public interface Listing {
|
|||
*/
|
||||
public CodeUnit getDefinedCodeUnitBefore(Address addr);
|
||||
|
||||
/**
|
||||
* Get an iterator over all the composite data objects (Arrays, Structures,
|
||||
* and Union) in the program.
|
||||
*
|
||||
* @param forward true means get iterator that starts at the minimum address
|
||||
* and iterates forward. Otherwise it starts at the maximum
|
||||
* address and iterates backwards.
|
||||
* @return an iterator over all the composite data objects.
|
||||
*/
|
||||
public DataIterator getCompositeData(boolean forward);
|
||||
|
||||
/**
|
||||
* Get an iterator over all the composite data objects (Arrays, Structures,
|
||||
* and Union) in the program at or after the given Address.
|
||||
*
|
||||
* @param start start of the iterator
|
||||
* @param forward true means get iterator in forward direction
|
||||
* @return an iterator over all the composite data objects starting with the
|
||||
* given address.
|
||||
*/
|
||||
public DataIterator getCompositeData(Address start, boolean forward);
|
||||
|
||||
/**
|
||||
* Get an iterator over all the composite data objects (Arrays, Structures,
|
||||
* and Union) within the specified address set in the program.
|
||||
*
|
||||
* @param addrSet the address set
|
||||
* @param forward true means get iterator in forward direction
|
||||
* @return an iterator over all the composite data objects in the given
|
||||
* address set.
|
||||
*/
|
||||
public DataIterator getCompositeData(AddressSetView addrSet, boolean forward);
|
||||
|
||||
/**
|
||||
* Returns an iterator over all user defined property names.
|
||||
*
|
||||
|
|
|
@ -267,21 +267,6 @@ public class StubListing implements Listing {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(boolean forward) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(Address start, boolean forward) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataIterator getCompositeData(AddressSetView addrSet, boolean forward) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getUserDefinedProperties() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -199,20 +199,6 @@ public interface ChangeManager {
|
|||
@Deprecated
|
||||
public static final ProgramEvent DOCR_CODE_MOVED = FRAGMENT_CHANGED;
|
||||
|
||||
/**
|
||||
* Structure was added.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_COMPOSITE_ADDED = COMPOSITE_ADDED;
|
||||
|
||||
/**
|
||||
* Structure was removed.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ProgramEvent DOCR_COMPOSITE_REMOVED = COMPOSITE_REMOVED;
|
||||
|
||||
/**
|
||||
* Data was replaced.
|
||||
* @deprecated Event type numeric constants have been changed to enums. Use the enum directly.
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -37,9 +37,6 @@ public enum ProgramEvent implements EventType {
|
|||
CODE_REMOVED, // instructions or data cleared at an address
|
||||
CODE_REPLACED, // the instruction or data type at an address was changed
|
||||
|
||||
COMPOSITE_ADDED, // a non-primitive data type was added
|
||||
COMPOSITE_REMOVED, // a non-primitive data type was removed
|
||||
|
||||
CODE_UNIT_PROPERTY_CHANGED, // a property map value changed
|
||||
CODE_UNIT_PROPERTY_ALL_REMOVED, // a property map was removed
|
||||
CODE_UNIT_PROPERTY_RANGE_REMOVED, // a ranges of values was removed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue