mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-25 10:59:02 +08:00
GP-0 corrected test failures. Changed ProgramBuilder.applyDataType to
overwrite existing Data.
This commit is contained in:
@@ -146,8 +146,7 @@ public class ProgramBuilder {
|
||||
* @param language Language object
|
||||
* @throws Exception if there is an exception creating the program
|
||||
*/
|
||||
public ProgramBuilder(String name, Language language)
|
||||
throws Exception {
|
||||
public ProgramBuilder(String name, Language language) throws Exception {
|
||||
CompilerSpec compilerSpec = language.getDefaultCompilerSpec();
|
||||
program = new ProgramDB(name, language, compilerSpec, this);
|
||||
setAnalyzed();
|
||||
@@ -320,8 +319,8 @@ public class ProgramBuilder {
|
||||
|
||||
return tx(() -> {
|
||||
return program.getMemory()
|
||||
.createInitializedBlock(name, addr(address), size, (byte) 0, TaskMonitor.DUMMY,
|
||||
true);
|
||||
.createInitializedBlock(name, addr(address), size, (byte) 0, TaskMonitor.DUMMY,
|
||||
true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -653,6 +652,7 @@ public class ProgramBuilder {
|
||||
|
||||
/**
|
||||
* Creates a data instance at the specified address, repeated {@code N} times.
|
||||
* Any conflicting Data will be overwritten.
|
||||
*
|
||||
* @param addressString address.
|
||||
* @param dt {@link DataType} to place at address, {@link Dynamic} length datatype not supported.
|
||||
@@ -662,7 +662,7 @@ public class ProgramBuilder {
|
||||
tx(() -> {
|
||||
Address address = addr(addressString);
|
||||
for (int i = 0; i < n; i++) {
|
||||
CreateDataCmd cmd = new CreateDataCmd(address, dt);
|
||||
CreateDataCmd cmd = new CreateDataCmd(address, true, dt);
|
||||
if (!cmd.applyTo(program)) {
|
||||
throw new AssertException(
|
||||
"Could not apply data at address " + address + ". " + cmd.getStatusMsg());
|
||||
|
||||
+4
-3
@@ -183,8 +183,9 @@ public class StackEditorActions2Test extends AbstractStackEditorTest {
|
||||
|
||||
sv = stack.getVariableContaining(0xc);
|
||||
assertNotNull(sv);
|
||||
assertTrue(sv.getDataType().isEquivalent(
|
||||
PointerDataType.getPointer(StringDataType.dataType, program.getDataTypeManager())));
|
||||
assertTrue(sv.getDataType()
|
||||
.isEquivalent(PointerDataType.getPointer(StringDataType.dataType,
|
||||
program.getDataTypeManager())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -515,7 +516,7 @@ public class StackEditorActions2Test extends AbstractStackEditorTest {
|
||||
assertEquals("", model.getStatus());
|
||||
assertEquals(num, model.getNumComponents());
|
||||
assertCellString("pointer32 *", ordinal, model.getDataTypeColumn());
|
||||
assertEquals("pointer32 *", getDataType(ordinal).getName());
|
||||
assertEquals("pointer32 *32", getDataType(ordinal).getName());
|
||||
assertTrue(((Pointer) getDataType(ordinal)).getDataType().isEquivalent(dt));
|
||||
assertEquals(4, getDataType(ordinal).getLength());
|
||||
assertEquals(4, model.getComponent(ordinal).getLength());
|
||||
|
||||
Reference in New Issue
Block a user